Adaptive filter principle - block LMS algorithm (BLMS)

In order to further improve the stability of the LMS algorithm, a block processing LMS (Block LMS) is proposed on the basis of LMS. The LMS algorithm adjusts the filter weight every time a sampling point comes, that is, every time a sample point comes, the weight is updated once, which leads to the update frequency of the weight being too fast, resulting in slow and unstable convergence; The BLMS algorithm updates the weight of the filter every K sampling points, similar to the batch_szie of the neural network, collects a set of data (L samples), calculates the mean value of the error, and then updates it, that is, every L samples, the weights are updated once.

 Schematic of block adaptive filter

The input data sequence is divided into several data blocks whose length is L through the serial-to-parallel converter. Then these data blocks are sent into the filter with a length of M one at a time, and after each block of data samples are collected, the filter tap weights are updated, so that the adaptive process of the filter is carried out block by block, and It is not performed value by value like the traditional adaptive filtering algorithm in time domain.

The specific algorithm is as follows:

After accumulating L sampling points, we update the filter coefficients again

 All the above formulas are added together, and the middle formula can be canceled left and right, and the update formula of the Block LMS filter weight can be obtained:

Among them, μ is the step size factor. For the convenience of derivation, we usually set L=N, and updating the block LMS once is equivalent to updating the LMS by L times. We use a new time index k to represent the update of Block LMS coefficients, where kL=n, the above formula can be written as:

Another way of writing the formula:

 

  • Advantages : the amount of calculation is much smaller than that of LMS
  • Disadvantage : The convergence speed is the same as the LMS algorithm

The MATLAB code is as follows:

% 参考:https://github.com/Morales97/ASP_P2/blob/4a6a17f6fe/algorithms/block_lms.m
function [e, y, w] = myBlock_LMS(d,x,mu, M,L)
    % 输入:
    % d - 麦克风语音
    % x - 远端语音
    % mu - 步长
    % M - 滤波器阶数
    % L - 块大小
    %
    % Outputs:
    % e - 输出误差,近端语音估计
    % y - 输出系数,远端回声估计
    % w - 滤波器参数

    d_length = length(d); 
    K = floor(d_length / L);    % 块的数量,确保整数
    y = zeros(d_length, 1);
    w = zeros(M,K+1);
    e = zeros(d_length,1);
    x_ = [zeros(M-1,1); x];

    % 根据"块"进行循环
    for k=1:K
        block_sum = 0;
        % 求一个块的和sum
        for i = 1 + L*(k-1):L*k
            X = x_(i:i+M-1);
            y(i) = w(:,k)' * X;  % 滤波器输出

            e(i) = d(i) - y(i);
            block_sum = block_sum + X * e(i);   % 权重更新
        end

        w(:,k+1) = w(:,k) + mu * block_sum;
    end

    % 将指针移动一步,使第n行对应于时间n
    w=w(:,2:K+1);
end

Reference link:

https://www.cnblogs.com/LXP-Never/p/11773190.html

Guess you like

Origin blog.csdn.net/qq_42233059/article/details/131343840