Introduction of FxLMS algorithm

Filtering X-LMS algorithm, also known as FxLMS algorithm, is improved on the basis of LMS algorithm, considering the influence of secondary acoustic channels on active noise control system. The block diagram of its algorithm principle is shown in Figure 1.Where x(n) is the estimated reference signal, W(Z) is the transverse filter, S(Z) is the acoustic path from the secondary speaker to the error microphone, yw(n) is the output of the filter, and Sh(Z) is the estimate of S(Z). Theoretically, Sh(Z) is equal to S(Z). E (n) is residual noise. The calculation process of FxLMS algorithm is as follows: 1) Calculate the filter output YW (n)Where wL=[w0(n), W1 (n),w2(n),… wL-1(n)] is the filter tap weight coefficient; X (n – L) = [x (n), x (n – 1),…, n – (L + 1)] for filter corresponding to input vector, L the length of the filter. 2) Calculate the acoustic wave ys(n) ys(n)=yw(n) transmitted to the error microphoneIn S(n) (2),”“Is linear convolution operation, S(n) is the impulse response of S(Z). 3) Calculate the input signal of LMS algorithm xh(n) xh(n)=x(n)*Sh(n) (3) where Sh(n) is the impulse response of Sh(Z). 4) to calculate the residual noise e (n) (n) = d (n) + e ys (n) (4) 5) computing tap update weight vector w (n) w (n + 1) = w (n) (n) + 2 mu e · xh (n) (5) type of mu for fixed step length factor, its convergence range as shown in the following typeWhere δ is the delay in considering the existence of the secondary path, and Pxn is the power of the filtered input signal.

Two, some source code

% -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - %Set simulation duration (normalized) 
clear
T=1000; 

% We do not know P(z) and S(z) in reality. So we have to make dummy paths
Pw= [0.01 0.25 0.5 1 0.5 0.25 0.01];
Sw=Pw*0.25;

% Remember that the first task is to estimate S(z). So, we can generate a
% white noise signal,


% send it to the actuator, and measure it at the sensor position, 


% Then, start the identification process
Shx=zeros(1.16);     % the state of Sh(z)
Shw=zeros(1.16);     % the weight of Sh(z)
e_iden=zeros(1,T);   % data buffer for the identification error

% and apply least mean square algorithm
mu=0.1;                         % learning rate
for k=1:T,                      % discrete time k
  
    Shy=sum(Shx.*Shw);	        % calculate output of Sh(z)
    e_iden(k)=y_iden(k)-Shy;    % calculate error         
    Shw=Shw+mu*e_iden(k)*Shx;   % adjust the weight
end

% Lets check the result
subplot(2.1.1)
plot([1:T], e_iden)
ylabel('Amplitude');
xlabel('Discrete time k');
legend('Identification error');
subplot(2.1.2)
stem(Sw) 
hold on 
stem(Shw, 'r*')
ylabel('Amplitude');
xlabel('Numbering of filter tap');
legend('Coefficients of S(z)'.'Coefficients of Sh(z)')


% The second task is the active control itself. Again, we need to simulate 
% the actual condition. In practice, it should be an iterative process of
% 'measure'.'control'.and 'adjust'; sample by sample. Now, let's generate 
% the noise: 
X=randn(1,T);

% and measure the arriving noise at the sensor position,

  
% Initiate the system,
Cx=zeros(1.16);       % the state of C(z)
Cw=zeros(1.16);       % the weight of C(z)
Sx=zeros(size(Sw));   % the dummy state for the secondary path
e_cont=zeros(1,T);    % data buffer for the control error
Xhx=zeros(1.16);      % the state of the filtered x(k)

% and apply the FxLMS algorithm
mu=0.1;                            % learning rate
for k=1:T,                         % discrete time k
    Cx=[X(k) Cx(1:15)];            % update the controller state    
    Cy=sum(Cx.*Cw);                % calculate the controller output	
    Sx=[Cy Sx(1:length(Sx)- 1)];    % propagate to secondary path
    e_cont(k)=Yd(k)-sum(Sx.*Sw);   % measure the residue
  
end

% Report the result
figure
subplot(2.1.1)
plot([1:T], e_cont)
ylabel('Amplitude');
xlabel('Discrete time k');
legend('Noise residue')
subplot(2.1.2)
plot([1:T], Yd) 
hold on 
plot([1:T], Yd-e_cont, 'r:')
ylabel('Amplitude');
xlabel('Discrete time k');
legend('Noise signal'.'Control signal')
Copy the code

3. Operation results

Matlab version and references

1 matlab version 2014A

[1] Han Jiqing, Zhang Lei, Zheng Tieran. Speech Signal Processing (3rd edition) [M]. Tsinghua University Press, 2019. [2] LIU Ruobian. [3] Gong Xiaoping, GUO Yong, LIU Qiang, ZHU Zaisheng. Deep Learning: Practice of Speech Recognition Technology [M]. Tsinghua University Press, 2019. Improved FxLMS Algorithm and DSP Implementation for Active Noise Reduction of Cab [J]. Sensors and Microsystems, 201,40(09)