Question

LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals clear all close al

implement the LMS algorithm to clean up the signal with noise. Experiment with noise power being stronger than the signal, sa

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Main Code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

close all,
clear all,
clc,

Fs=1000;
F=50;
T = 1/Fs;
L=10000;
t=(0:(L-1))*T;

ShowLength=150;
length(t)

d = 0.7*sin(2*pi*F*t);
Noise = rand(size(t)); %Full Scale Noise Input to Filter
x = d + 10*Noise;


subplot(5,1,1); plot(Fs*t(1:ShowLength),d(1:ShowLength)); grid on, title('Original Clean Signal');
subplot(5,1,2); plot(Fs*t(1:ShowLength),Noise(1:ShowLength)); grid on, title('Full Scale Noise Signal');
subplot(5,1,3); plot(Fs*t(1:ShowLength),x(1:ShowLength)); grid on, title('Original Signal Corrupted with Full Scale Zero Mean Random Noise');


Order=31;
h = fir1(Order,0.5); % FIR system to be identified
delta = 0.001; % LMS step size.
N= length(h);
DesiredSignal = filter(h,1,x)+ (Noise); % Desired signal at 10 times the Full scale Noise
[h,y] = mylms(x,DesiredSignal,delta,N,Fs,t);
subplot(5,1,4); plot(Fs*t(1:ShowLength),2*y(1:ShowLength)); grid on, title('Filtered Signal');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Function Code

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [h, y] = mylms(x,d,delta,N,Fs,t)
M = length(x);
h = zeros(1,N);
for n=N:M
x1 = x(n:-1:n-N+1);
y(n) = h*x1';
e = d(n)-y(n);
h=h+delta*e*x1;
end

end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

As the step size decreases, the ASE decreases.Original Clean Signal 150 100 F0 Full Scale Noise Signal 150 100 50 Original Signal Comupted with Full Scale Zero Mean Random

Add a comment
Know the answer?
Add Answer to:
LMS project Using the notes discussed in class: Implementing the LMS Algorithm First generate some signals...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT