自适应最大二阶循环平稳盲解卷积算法(Adaptive Maximum Second-Order Cyclostationarity Blind Deconvolution,简称ACYCBD)是一种用于信号处理和图像复原的高级算法,特别是在处理含有噪声和抖动的信号时表现出色。该算法结合了循环平稳特性和盲解卷积技术,旨在从复杂的信号中恢复出清晰的原始信号或图像。
一、算法原理
ACYCBD算法利用信号的循环平稳特性,通过检测和分析这些周期性变化,来提取信号中的有用信息。盲解卷积被用于处理信号中的噪声和干扰,以恢复出更清晰的信号。
信号建模:
参数估计:
信号恢复:
自适应优化:
ACYCBD算法首先建立信号的循环平稳模型,该模型描述了信号统计特性的周期性变化规律。通过该模型,算法能够捕捉到信号中的周期性成分,为后续处理提供基础。
利用盲解卷积技术,算法在不知道系统具体参数的情况下,对观测信号进行处理。
通过迭代优化等方法,算法逐步估计出原始信号和系统参数。
根据估计出的参数,算法对观测信号进行反卷积处理,以恢复出原始信号。
在处理过程中,算法会同时考虑信号的循环平稳特性和盲解卷积的约束条件,以确保恢复出的信号既符合实际情况又尽可能清晰。
ACYCBD算法具有自适应优化的特点,能够在处理过程中根据信号的实际情况自动调整参数和算法策略。
这种自适应性使得算法能够更好地应对复杂多变的信号环境,提高信号恢复的准确性和鲁棒性。
ACYCBD算法在多个领域都有广泛的应用,包括但不限于:
机械故障诊断:用于从含噪振动信号中恢复与故障相关的冲击成分,提高故障诊断的准确性和可靠性。
图像处理:用于从模糊或噪声图像中恢复出清晰的原始图像,提高图像的质量和可识别度。
通信信号处理:用于从接收到的信号中恢复出原始的发送信号,提高通信的可靠性和效率。
综上所述,自适应最大二阶循环平稳盲解卷积算法通过结合循环平稳特性和盲解卷积技术,实现了对复杂信号的有效处理和恢复。该算法在多个领域都有重要的应用价值和发展前景。
二、代码实战
clear
close all
clc
%% load simulated data
load sig2
x = x - mean(x);
addpath('..\00 subfunction\')
%% Plot raw data
% Raw data
figure
plot((0:length(x) - 1)' / fs, x, 'b')
set(get(gca, 'XLabel'), 'String', 'Time [s]');
set(get(gca, 'YLabel'), 'String', 'Amplitude');
set(get(gca, 'Title'), 'String', 'Raw data in time domain');
set(gcf, 'pos', [400 100 800 400])
setfontsize(18)
% Envelope spectrum of raw data
en_x = abs(hilbert(x));
en_spec_x = abs(fft(en_x - mean(en_x), length(en_x))) * 2 / length(en_x);
figure
plot(0:fs / length(x):fs - fs / length(x), en_spec_x, 'b')
set(get(gca, 'XLabel'), 'String', 'Frequency [Hz]');
set(get(gca, 'YLabel'), 'String', 'Amplitude');
set(get(gca, 'Title'), 'String', 'Envelope spectrum of Raw data');
set(gcf, 'pos', [400 100 800 400])
setfontsize(18)
xlim([0 200])
ylim([0 0.12]);
%% ACYCBD
[h_final, s, kappa, W, count, err, f_est] = ACYCBD(x, fs, 40);
%% Plot deconvolved result
% Estimated cyclic frequency
figure
plot(1:count, f_est, 'b-*', 'LineWidth', 1)
hold on
plot((1:count), BPFI * ones(count, 1), 'r-^', 'LineWidth', 1)
set(get(gca, 'XLabel'), 'String', 'Iteration');
set(get(gca, 'YLabel'), 'String', 'Frequency [Hz]');
set(get(gca, 'Title'), 'String', 'Estimated cyclic frequency');
set(gcf, 'pos', [400 100 800 400])
setfontsize(18)
% Deconvolved signal
figure
plot((0:length(s) - 1) / fs, s, 'b')
set(get(gca, 'XLabel'), 'String', 'Time [s]');
set(get(gca, 'YLabel'), 'String', 'Amplitude');
set(get(gca, 'Title'), 'String', 'Deconvolved signal in time domain by ACYCBD');
set(gcf, 'pos', [400 100 800 400])
setfontsize(18)
% Envelope spectrum of Deconvolved signal
s = s - mean(s);
en_s = abs(hilbert(s));
en_spec_s = abs(fft(en_s - mean(en_s), length(en_s))) * 2 / length(en_s);
figure
plot(0:fs / length(en_s):fs - fs / length(en_s), en_spec_s, 'b')
set(get(gca, 'XLabel'), 'String', 'Frequency [Hz]');
set(get(gca, 'YLabel'), 'String', 'Amplitude');
set(get(gca, 'Title'), 'String', 'Envelope spectrum of deconvolved signal by ACYCBD');
set(gcf, 'pos', [400 100 800 400])
setfontsize(18)
xlim([0 200])
ylim([0 0.3]);
function [h_final, s, kappa, W, count, err, f_est] = ACYCBD(x, fs, N, param, p, K)
%
%---------------
% Input:
%---------------
%
% x : signal to be analyzed
% N : filter size
% param : structure of setting parameters organized as follows:
% param.ER : minimal relative error on result (default value = 1e-3)
% param.iter : maximum number of iterations (default value = 50)
% p : cyclostationarity order to maximize (default = 2)
% fs : sampling frequency of x
% K : frequency order in EHPS(default = 10)
% flim : frequency range in EHPS [Hz](default = 30)
%
%---------------
% Output:
%---------------
%
% h_final : optimal inverse FIR filter at convergence
% s : blindly deconvolved signal
% kappa : value of criterion at convergence
% W : weights used in the criterion at convergence
% count : number of iteration to convergence
% err : relative error on result as a function of iterations
% f_est : estimated result as a function of iterations
%
%---------------
% Note:
%---------------
% Original CYCBD is coded by J. Antoni and M. Buzzoni.
% This ACYCBD code is based on original CYCBD.
% Reference
% M. Buzzoni, J. Antoni, G. D'Elia,
% Blind deconvolution based on cyclostationarity maximization
% and its application to fault identification
% Journal of Sound And Vibration, 432 (2018) 569-601.
%---------------
% Reference:
%---------------
% Author: ¡¾1¡¿B. Zhang, Y. Miao, J. Lin, Y. Yi
% "Adaptive maximum second-order cyclostationarity blind deconvolution
% and its application for locomotive bearing fault diagnosis"
% Mechanical Systems and Signal Processing, 158 (2021) 107736.
% ¡¾2¡¿Y. Miao, B. Zhang, J. Lin et al.,
% ¡°A review on the application of blind deconvolution in machinery fault diagnosis¡±
% Mechanical Systems and Signal Processing, 163 (2022) 108202.
%-------------------------------------------------
%
% Author: @ Boyao Zhang
%
%-------------------------------------------------
%
if nargin < 6
K = 10;
end
if nargin < 5
p = 2;
end
if nargin < 4
param.RE = 1e-3;
param.iter = 50;
end
if nargin < 3
N = 40;
end
L = length(x);
x = x - mean(x);
h = zeros(N, 1);
h(2) = 1;
XX = CorrMatrix(x, [], N);
test = 0;
count = 1;
kappa_old = 0;
err = zeros(param.iter, 1);
f_est = [];
while test == 0
s = filter(h, 1, x);
W = abs(s(N:L)).^p;
alpha_est = EHPS(s, fs, K);
f_est = [f_est, alpha_est(1)];
alpha = alpha_est(1) * (1:100)';
W = Periodic(W, alpha, fs);
W = W / (mean(W).^(p / 2));
XWX = CorrMatrix(x, W, N);
[h, kappa] = eigs(XWX, XX, 1);
err(count) = abs(kappa - kappa_old) / abs(kappa_old);
if (err(count) < param.RE) || count >= param.iter
test = 1;
end
count = count + 1;
kappa_old = kappa;
end
h_final = h;
count = count - 1;
s = filter(h, 1, x);
s = s(N:end);
end
% End of the main function: ACYCBD
%--------------------------------------------------------------------------
function f_est = EHPS(x, fs, K, flim)
% estimate the period or frequency hidden in x.
% The sub-function is based on harmonic-related spectrum structure.
%---------------
% Input:
%---------------
%
% x : signal to be analyzed
% fs : sampling frequency of x
% K : frequency order in EHPS
% flim : frequency range in EHPS [Hz]
%
%---------------
% Output:
%---------------
%
% f_est : estimated result
%
%-------------------------------------------------
%
% Author: @ Zhang Boyao
%
%-------------------------------------------------
%
if nargin < 4
flim = 300;
end
if nargin < 3
K = 10;
end
L = length(x);
x = x(:);
x = x - mean(x);
ex = abs(hilbert(x));
ex = ex - mean(ex);
sex = abs(fft(ex, L)) * 2 / L;
sex = sex(1:round(L / 2));
ehpsx = ones(round(flim * fs / L), 1);
ff = sex(2:end);
for f = 1:length(ehpsx)
for k = 1:K
if k * f < fs / 2
ehpsx(f) = ehpsx(f) * ff(k * f);
end
end
end
[~, index_max] = max(ehpsx);
f_est = index_max * (fs / L);
end
% End of the first sub-function: EHPS
%--------------------------------------------------------------------------
function R = CorrMatrix(x, W, N)
% Compute correlation matrix (NxN) of signal x with weights W
%---------------
% Input:
%---------------
%
% x : signal to be analyzed
% W : the weight vector
% N : The size of correlation matrix (NxN).
%
%---------------
% Output:
%---------------
%
% R : correlation matrix R_(xx) (NxN) while W = []
% or weighted correlation matrix R_(xwx) (NxN) while W ~= [].
%-------------------------------------------------
% Code by J. Antoni and M. Buzzoni
% Dicember 2017
%-------------------------------------------------
L = length(x);
R = zeros(N);
if isempty(W)
W = ones(L - N + 1, 1);
end
W = W(:);
x = x(:);
for i = 1:N
R(i, i) = mean(abs(x(N + 1 - i:L + 1 - i)).^2 .* W);
for j = i + 1:N
R(i, j) = mean(x(N + 1 - i:L + 1 - i) .* conj(x(N + 1 - j:L + 1 - j)) .* W);
R(j, i) = conj(R(i, j));
end
end
end
% End of the second sub-function: CorrMatrix
%--------------------------------------------------------------------------
function p = Periodic(x, alpha, fs)
% Extract cyclic components with frequencies alpha in x
%---------------
% Input:
%---------------
%
% x : signal to be analyzed
% alpha : cyclic frequecny vector
% fs : sampling frequency of x
%
%---------------
% Output:
%---------------
%
% p : cyclic components with frequencies alpha in x
%
%-------------------------------------------------
% Code by J. Antoni and M. Buzzoni
% Dicember 2017
%-------------------------------------------------
x = x(:);
L = length(x);
dt = 1 / fs;
T = dt * L;
t = (0:dt:T - dt)';
K = length(alpha);
alpha(alpha == 0) = [];
p = mean(x);
for k = 1:K
c = mean(x .* exp(-2i * pi * alpha(k) .* t));
p = p + 2 * real(c * exp(2i * pi * alpha(k) .* t));
end
% thresholding for improve weighting matrix
th = mean(p) + 2 * std(p);
% th = quantile(p,3)
% th = th(3)
p(p < th) = 0;
end
% End of the 3rd sub-function: Periodic
仿真结果: