MET 1113 - EE - Lab Simulation 2
MET 1113 - EE - Lab Simulation 2
ENVIRONMENT
LABORATORY EXPERIMENT 2
1
EXPERIMENT 2 (CLO 2, PLO 1, PLO 2, PLO 6, P7):
STUDY OF SIGNAL ENHANCEMENT USING LMS AND NLMS ALGORITHMS
1.0 Objectives
2.0 Equipment
Software: MATLAB
3.0 Theory
Using the least mean square (LMS) and normalized LMS algorithms, extract the desired
signal from a noise-corrupted signal by filtering out the noise.
4.0 Program
4.1 Create the signals for adaption
The desired signal (the output from the process) is a sinusoid with 1000 samples per
frame. Run the code program below:
2
4.2 Generate the Noise Signal
Create a noise signal with autoregressive noise (defined as v1). In autoregressive noise,
the noise at time t depends only on the previous values and a random disturbance. Run
the code program below:
>> v = 0.8*randn(sine.SamplesPerFrame,1); % Random noise part.
>> ar = [1,1/2]; % Autoregression coefficients.
>> ARfilt = dsp.IIRFilter('Numerator',1,'Denominator',ar)
>> v1 = ARfilt(v);
Adaptive filter processing seeks to recover s from x by removing v1. To complete the
signals needed to perform adaptive filtering, the adaptation process requires a reference
signal
3
4.5 Construct Two Adaptive Filters
Two similar, sixth-order adaptive filters — LMS and NLMS — form the basis of this
example. Run the code program below:
>> L = 7;
>> lms = dsp.LMSFilter(L,'Method','LMS')
>> nlms = dsp.LMSFilter(L,'Method','Normalized LMS')
5
Fig 6 – Output for 4.7 – lms
6
4.9 Compute the Optimal Solution
For comparison, compute the optimal FIR Wiener filter. Run the code program below:
>> reset(MAfilt);
>> bw = firwiener(L-1,v2,x); % Optimal FIR Wiener filter
>> MAfilt = dsp.FIRFilter('Numerator',bw)
>> yw = MAfilt(v2); % Estimate of x using Wiener filter
>> ew = x - yw; % Estimate of actual sinusoid
8
4.12 Reset the Filter Before Filtering
You can reset the internal filter states at any time by calling the reset function on the
filter object. For instance, these successive calls produce the same output after resetting
the object. Run the code program below:
>> [ylms,elms,wlms] = lms(v2,x);
>> [ynlms,enlms,wnlms] = nlms(v2,x);
If you do not reset the filter object, the filter uses the final states and coefficients from the
previous run as the initial conditions and data set for the next run.
>> v2 = MAfilt(v);
9
Fig 13 – Output for 4.13 – Arfilt
5.0 Conclusion
Signal enhancement using LMS & LNMS algorithms is demonstrated by writing a program code
in MATLAB r2023b and the output waveform is demonstrated.
11
COURSE: Advanced Digital Signal Processing (MET 1113)
LAB EXPERIMENT 2 (CLO 2, PLO 1, PLO 2, PLO 6, P7): Study of Signal Enhancement
using LMS and NLMS Algorithms
12