SkillAgentSearch skills...

Meta

Fast Adaptive Active Noise Control based on Modified Model-Agnostic Meta-Learning Algorithm

Install / Use

/learn @ShiDongyuan/Meta
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Model-Agnostic Meta-Learning (MAML) for Adaptive Filter

This document describes the process and findings of testing the MAML algorithm for enhancing the convergence of the FxLMS algorithm in noise cancellation applications, specifically targeting aircraft noise.

Introduction

The purpose of this test is to evaluate the Modified MAML (Model-Agnostic Meta-Learning) algorithm's effectiveness in initializing control filters for adptive active noise cancellation.

<img src=Images/Fig_2_Single_FxLMS.jpg width=70% />

Figure 1: the adaptive feedforward active noise control system based on the filtered reference square (FxLMS) algorithm.

As illustrated in Figure 1, the standard active noise control typically utilizes the filtered reference least mean square (FxLMS) algorithm to realize the adaptive noise cancellation. The error signal in this ANC system is given by

$$\begin{equation}e(n)=d(n)-\mathbf{w}^\mathrm{T}(n)\mathbf{x}^\prime(n),\end{equation}$$

where $d(n)$ and $\mathbf{w}(n)$ denote the disturbance and the control filter vector, respectively; and the filtered reference vector is expressed as

$$\begin{equation}\mathbf{x}^\prime(n)=\begin{bmatrix}x^\prime(n)&x^\prime(n-1)&\cdots&x^\prime(n-N+1)\end{bmatrix}^\mathrm{T}\end{equation}$$

In the above vector, the filtered reference signal is obtained from

$$\begin{equation}x^\prime(n)=\hat{s}(n){\ast}x(n),\end{equation}$$

where $\hat{s}(n)$ repsenets the impulse response of the secondary path estimate.

According to the gradient descent method, the updation of the control filter in the FxLMS algorithm is given by

$$\begin{equation}\mathbf{w}(n+1)=\mathbf{w}(n)+{\mu}e(n)\mathbf{x}^\prime(n),\end{equation}$$

where $\mu$ denotes the step size. From the above recursive formula, we can find that the FxLMS algorithm is highly computationally efficient. However, like other LMS-based algorithms, the FxLMS algorithm also encounters a slow convergence issue. Hence, the following paragram will bring a modified MAML approach to help the standard FxLMS algorithm seek the best initial control filter, which will assist it in achieving a fast convergence behavior.

The entire progress of the modified MAML algorithm is shown in Figure 2. This MAML algorithm contains the following steps:

  • Building the input vectors from the randomly sampled pair: $\{\mathbf{x}^\prime(n), \mathbf{d}(n)\}$. Here, $k=n$

$$\mathbf{x}^\prime(k-i)=\begin{bmatrix}x'(n-i)&x'(n-i-1)&\cdots&\mathbf{0}_{1\times i}\end{bmatrix}^\mathrm{T}$$

$$d(k-i)=d(n-i),~~~i=0,1,\cdots,N-1$$

  • Get the error signal based on the initial control:

$$\begin{equation}e^+(k)=d(k)-\mathbf{\Phi}^\mathrm{T}(n)\mathbf{x}^\prime(k)\tag{A2}\end{equation}$$

  • Obtain the control filter:

$$\begin{equation}\mathbf{w}(n) = \mathbf{\Phi}(n)+\mu e^+(k)\mathbf{x}^\prime(k) \tag{A3}\end{equation}$$

  • Get the error signal based on the new control filter:

$$\begin{equation}e(k-i)=d(k-i)-\mathbf{w}^\mathrm{T}(n)\mathbf{x}^\prime (k-i) \tag{A4}\end{equation}$$

  • Update the initial value :

$$\begin{equation}\mathbf{\Phi}(n+1)=\mathbf{\Phi}(n)+\varepsilon\sum_{i=0}^{N-1}\lambda^ie(k-i)\mathbf{x}^\prime(k-i)\tag{A5}\end{equation} $$

<img src=Images/MAML_progress.jpg width=70% />

Figure 2: Block diagram of the modified MAML algorithm progress.

The The entire progress of the modified MAML algorithm is shown in Figure 2. The one epoch of this algorithm consists of three stages.

  • Stage 1: The initial control filter vector $\mathbf{\Phi}(n)$ will take one step to update the pseudo optimal control filter $\mathbf{w}(n)$.
  • Satge 2: The pseudo-optimal control filter $\mathbf{w}(n)$ will be used to cancel the disturbance samples with their corresponding filtered reference vector and get the gradients.
  • Stage 3: These gradients are used to update the initial control filter vector $\mathbf{\Phi}(n) $ so that to get the new value $\mathbf{\Phi}(n+1) $.

In that way, the program continues to the next epoch ($n+1$) until the algorithm converges.

Code Explanation

  • Main_tst_function.m: the main function is utilized to test the proposed modified MAML algorithm.
  • MAML_Nstep_forget.m: the matlab code of the modified MAML algorithm.
  • FxLMS.m: the matlab code of the FxLMS algorithm.
  • 707_Sound_for_Simulation.mat: the raw data of an aircrat noise.
  • \path: the measured primary and secondary paths.

The explanation of Main_tst_function.m

The following code snippet offers a concise overview of Main_tst_function.m, which serves as the main function for evaluating the effectiveness of the proposed MAML method. For this numerical simulation, three distinct broadband sounds are utilized to train the MAML algorithm and obtain a single initial control filter. Subsequently, the aforementioned initial control is employed within an FxLMS algorithm to effectively eliminate actual aircraft noise. In comparison to zero initialization, the MAML technique can significantly enhance the convergence speed of the conventional FxLMS approach.

Contents:

Clean the memory and worksapace

Code snippet to clean workspace and set initial conditions.

%% Clean the memory and worksapace 
close all ;
clear     ;
clc       ;

Configure the system simulation condition

This code snippet provides the system configuration for the numerical simulation. In this program, $f_s$ and $T$ denote the system sampling rate and the simulation duration, respectively. $Len_N$ repesents the length of the control filter.

| Para | Definition | Para | Definition | |-------|------------------------------|------|---------------------| | fs | Sampling rate | T | Simulation duration | | Len_N | Length of the control filter | | |

%% Configure the system simulation condition 
fs  =   16000    ; % The system sampling rate.
T   =   3        ; % The duration of the simulation.
t   =   0:1/fs:T ; 
N   =   length(t); % The number of the data.

Len_N = 512      ; % Seting the length of the control filter.
%<<===Progress bar===>> 
f = waitbar(0,'Please wait...');
pause(.5)

Build the broad band noise for training set

This section of the program produces filtered references, disturbances, and primary noises. These are then used in the modified MAML algorithm to obtain the initial control filter. The main sounds consist of three distinct broadband noises, as depicted in Figure S1.

| Para | Definition | Para | Definition | |----------|--------------------------------|-----------|----------------------------| | Pri_path | Primary path | Track_num | Number of the noise tracks | | Pri_n | n-th primary noise | Dis_n | n-th disturbance | | Rf_n | n-th filtered reference vector | | |

%% Build the broad band noise for training set
%<<===Progress bar===>> 
waitbar(0.25,f,'Build the broad band noise for training set');
pause(1)
%<<===Progress bar===>> 
% Loading path 
load('path\P1.mat')    ;
load('path\S11.mat')   ;
Pri_path = conv(P1,S11);

Track_num = 3         ; % Seting the number of the track for the trainning noise. 
if exist('Primary_noise.mat', 'file') == 2
    disp('Primary_noise exists in the current path.\n');
    % Loading the primary noise 
    load('Primary_noise.mat');
    load('Disturbance.mat')  ;
    load('Reference.mat')    ;
else
Noise     = randn(N,1);
% filter 
filter_1 = fir1(512,[0.05 0.25]);
filter_2 = fir1(512,[0.20 0.55]) ;
filter_3 = fir1(512,[0.5,0.75]) ;
% Primary noise 
Pri_1 = filter(filter_1,1,Noise) ;
Pri_2 = filter(filter_2,1,Noise) ;
Pri_3 = filter(filter_3,1,Noise) ;
% Drawing fiture 
data = [Pri_1,Pri_2,Pri_3];
figure ;
len_fft = length(Pri_1)   ;
len_hal = round(len_fft/2);
title('Frequency spectrum of primary noises')
for ii = 1:3
    freq = 20*log(abs(fft(data(:,ii))));
    subplot(3,1,ii);
    plot(0:(fs/len_fft):(len_hal-1)*(fs/len_fft), freq(1:len_hal));
    grid on   ;
    title("The "+num2str(ii)+"th primary noise")
    xlabel('Frequency (Hz)')
end
% Save primary noise into workspace 
save('Primary_noise.mat','Pri_1','Pri_2','Pri_3');
% Generating Distrubance 
Dis_1 = filter(Pri_path,1,Pri_1);
Dis_2 = filter(Pri_path,1,Pri_2);
Dis_3 = filter(Pri_path,1,Pri_3);
% Save distrubancec into workspace 
save('Disturbance.mat','Dis_1','Dis_2','Dis_3');
% Genrating Filtered reference signal 
Rf_1 = filter(S11,1,Pri_1);
Rf_2 = filter(S11,1,Pri_2);
Rf_3 = filter(S11,1,Pri_3);
% Save filter reference signal into workspace 
save('Reference.mat','Rf_1','Rf_2','Rf_3');
end

Primary noises
Figure S1: The frequency spectrum of the primary noises for the MAML algorithm.

Randomly sampling the noise tracks to build dataset for the MAML algorithm

This part of the program randomly samples the previously generated three types of noise tracks and their corresponding reference signals and disturbances to form the dataset. The length of the sampled vector equals that of the control filter, and these sa

View on GitHub
GitHub Stars19
CategoryEducation
Updated1mo ago
Forks4

Languages

MATLAB

Security Score

75/100

Audited on Feb 4, 2026

No findings