一种基于SSAVMD算法的信号去噪方法,具体为:根据麻雀优化算法数学模型,然后进行初始化参数,在取值范围内初始化麻雀的位置向量,根据位置向量对原始振动信号进行VMD分解,然后计算每个麻雀位置下的平均包络熵;更新最小平均包络熵,即获得当前群体中最佳个体的位置更新当前麻雀个体的空间位置;输出最佳麻雀个体的位置向量,即得VMD的分解参数组合;根据所得到的分解参数组合对信号进行VMD分解,将分解出IMF分量相加得到重构信号,即得去噪后的信号.本发明解决了现有技术中存在的原始VMD算法的分解参数需要根据经验进行人工确定,导致无法得到最优分解结果,从而影响信号的去噪效果的问题.
function [SampEn] = SampEn(series, dim, r)
control = ~isempty(series);
assert(control, 'The user must introduce a time series (first inpunt).');
control = ~isempty(dim);
assert(control, 'The user must introduce a embbeding dimension (second inpunt).');
control = ~isempty(r);
assert(control, 'The user must introduce a tolerand: r (third inpunt).');
series = (series - mean(series)) / std(series);
N = length(series);
result = zeros(1, 2);
for j = 1:2
m = dim + j - 1;
patterns = NaN(m, N - m + 1);
count = NaN(1, N - m);
if m == 1
patterns = series;
else
for i = 1:m
patterns(i, :) = series(i:N - m + i);
end
end
for i = 1:N - m
if m == 1
temp = abs(patterns - repmat(patterns(:, i), 1, N - m + 1));
else
temp = max(abs(patterns - repmat(patterns(:, i), 1, N - m + 1)));
end
bool = (temp <= r);
count(i) = (sum(bool) - 1);
end
count = count / (N - m - 1);
result(j) = mean(count);
end
SampEn = log(result(1) / result(2));
end