next up previous contents
Next: 8 anvc_ mcadjlms Up: 10 Applications and Examples Previous: 6 anvc_ fdfxlms   Contents


7 anvc_ fxlms

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
Figure 10.13: Block diagram of a single channel noise cancellation application using the Filtered-x LMS algorithm.
The block diagram of the single channel ANVC problem using FXLMS is shown in Fig. 10.13. The primary impulse response $p$ is the impulse response measured between the noise source and the error microphone in a small room. The secondary impulse response $s$ is that between the secondary source and the error microphone. Two sets of transfer functions are provided in the simulation, the simple data set (system 1) and the measured data set (system 2). The description below applies to system 1, with primary impulse response sampled at 8 kHz and truncated to 32 coefficients, and a simple FIR secondary impulse response so that it can be easily experimented with its minimum phase and delay properties. The primary noise at the microphone is stored in the file dfile and the reference signal $x(n)$ (white noise) is stored in the file infile. First the variables for the controller $w(n)$ are creates and initializes using 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 $e(n)$ is saved in each iteration for later examination. This simulation script uses the standard ASPT iteration progress window (IPWIN). The IPWIN has four buttons which allow you to stop and continue the simulation, show or hide the simulation graph window, break out of the processing loop, and quit the simulation. After processing all the samples, or on pressing the break or stop buttons, the sensor signal $e(n)$ is written to a wave audio file and a graph presenting the controller performance is generated.


\epsfig{file=/home/john/winD/docs/aspt/aspt/figs/fxlms2.eps,width=\textwidth}


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
Figure 10.14: Performance of the FXLMS algorithm.
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.


\epsfig{file=/home/john/winD/docs/aspt/aspt/figs/anvcfxlms.eps,width=\textwidth}


Audio Files
The following files demonstrate the performance of the FXLMS algorithm.
wavin.wav Reference (input) signal
wavin32.wav microphone signal with controller OFF.
wavout.wav microphone signal with controller ON.

See Also
INIT_ FXLMS, ASPTFXLMS, ASPTFDFXLMS, ASPTMCFDFXLMS.

Reference
[3], Chapter 3.


next up previous contents
Next: 8 anvc_ mcadjlms Up: 10 Applications and Examples Previous: 6 anvc_ fdfxlms   Contents