| Purpose |
| Simulation of a single channel Active Noise and Vibration Control (ANVC) application using an adaptive controller updated according to the FILTERED-X Least Mean Squares (FXLMS) algorithm. |
| Syntax |
anvc_fxlms
|
| Description |
The block diagram of the single channel ANVC problem using FXLMS is shown in
Fig. 10.13. The primary impulse response init_fxlms(), and the input signals are read from files, then a processing loop
is started. In each iteration of the loop asptfxlms() is called with a new
reference sample and a new primary sample to calculate the controller output
(control effort) and update the controller coefficients. The sensor signal
|
| Code |
clear all; load .\data\h32; ph = h32; % Primary IR sh = [0; 0.4; 0.3; 0.2; 0.1; 0.05]; % Secondary IR se = 0.9*sh; % estimated sh Lph = length(ph); Lsh = length(sh); L = 40; % controller length mu = 0.02; % adaptation constant b = 0.98; % autoregressive pole infile = '.\wavin\scinwn.wav'; % reference signal dfile = '.\wavin\scdwn32.wav'; % d(n) = conv(x,h32) outfile = '.\wavout\fxlms.wav'; % sensor signal [w,x,y,d,e,p,fx] = init_fxlms(L,sh,se); % Init FXLMS inSize = wavread(infile, 'size'); % get input data size [xn,inFs,inBits] = wavread(infile); % get sampling details dSize = wavread(dfile, 'size'); % data size [dn,inFs,dBits] = wavread(dfile); % get sampling details inSize = max(min(inSize,dSize)); % Max. samples index E = init_ipwin(inSize); % Initialize IPWIN out = zeros(size(xn)); % sensor signal %% Processing Loop for (m=1:inSize) % update the delay line x = [xn(m,:); x(1:end-1,:)]; % update the controller [w,y,e,p,fx] = asptfxlms(w,x,y,sh,se,dn(m),fx,p, mu,b); % save the last sensor sample out(m) = e(1); % IPWIN handling section, see UPDATE\_~IPWIN for more details % update the iteration progress window [E, stop,brk] = update_ipwin(E,e(1),dn(m), 'a', w, ph,sh); % handle the Stop button while (stop ~= 0), stop = getStop; end; % handle the Break button if (brk), plot_anvc(w,ph,sh,E); break; end; end; plot_anvc(w,ph,sh,E); % generate ANVC plot wavwrite(out(1:m),inFs,inBits,outfile); % write to audio file |
| Results |
Running the above script will produce the graph shown in Fig. 10.14.
This figure shows the optimum (Wiener) solution of the problem at hand and compares
that with the solution approached by the adaptive controller. The top left and top
right panels show the impulse responses of the optimal solution and the adaptive
controller, respectively. The middle left and middle right panels show the frequency
responses of the optimal solution and the adaptive controller, respectively. The
bottom left panel shows the learning curve for the adaptive controller, and the
bottom right shows the difference between the optimal solution coefficients and the
adaptive controller coefficients.
|
| Audio Files |
The following files demonstrate the performance of the FXLMS algorithm.
|
| See Also |
| INIT_ FXLMS, ASPTFXLMS, ASPTFDFXLMS, ASPTMCFDFXLMS. |
| Reference |
| [3], Chapter 3. |