close all;
clear;
signal = sin(2*pi*0.055*[0:1000-1]');
noise=randn(1,1000);
nfilt=fir1(7,0.4); % Eighth order lowpass filter
fnoise=filter(nfilt,1,noise); % Correlated noise data
d=signal.'+fnoise;
coeffs = nfilt.' -0.01;
mu = 0.03;
ha = adaptfilt.lms(8,mu)
set(ha,'coefficients',coeffs);
[y,e] = filter(ha,noise,d);
subplot(3,1,1)
plot(0:199,signal(1:200),0:199,e(1:200));
title('Eighth order')
xlabel('sequence of time ')
ylabel('amplitude of signal,e')
nfilt=fir1(15,0.4); % sixteenth order lowpass filter
fnoise=filter(nfilt,1,noise); % Correlated noise data
d=signal.'+fnoise;
coeffs = nfilt.' -0.01;
mu = 0.03;
ha = adaptfilt.sd(16,mu)
set(ha,'coefficients',coeffs);
[y,e] = filter(ha,noise,d);
subplot(3,1,2)
plot(0:199,signal(1:200),0:199,e(1:200));
title('sixteenth order')
xlabel('sequence of time ')
ylabel('amplitude of signal,e')
nfilt=fir1(31,0.4); % thirty-second order lowpass filter
fnoise=filter(nfilt,1,noise); % Correlated noise data
d=signal.'+fnoise;
coeffs = nfilt.' -0.01;
mu = 0.03;
ha = adaptfilt.sd(32,mu)
评论0