next up previous contents
Next: 5 anvc_ fdadjlms Up: 10 Applications and Examples Previous: 3 ale_ soiir2   Contents


4 anvc_ adjlms

Purpose
Simulation of a single channel Active Noise and Vibration Control (ANVC) application using an adaptive controller updated according to the ADJOINT Least Mean Squares (ADJLMS) algorithm.

Syntax
anvc_adjlms



Description
Figure 10.7: Block diagram of a single channel noise cancellation application using the Adjoint-LMS algorithm.
The block diagram of the single channel ANVC problem using ADJLMS is shown in Fig. 10.7. 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 a 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_adjlms(), and the input signals are read from files, then a processing loop is started. In each iteration of the loop asptadjlms() 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/adjlms2.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\adjlms.wav';	         % sensor signal
 
[w,x,y,d,e,p]    = init_adjlms(L,sh,se);    % Init ADJLMS				
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] = asptadjlms(w,x,e,y,sh,se,dn(m),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.8: Performance of the ADJLMS algorithm.
Running the above script will produce the graph shown in Fig. 10.8. 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/anvcadjlms.eps,width=\textwidth}


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

See Also
INIT_ ADJLMS, ASPTADJLMS, ASPTMCADJLMS, ASPTFDADJLMS, ASPTMCFDADJLMS.

Reference
[3], Chapter 3.


next up previous contents
Next: 5 anvc_ fdadjlms Up: 10 Applications and Examples Previous: 3 ale_ soiir2   Contents