Digital Signal Processing Reference
In-Depth Information
1
0.5
0
0
500
1000
1500
2000
2500
3000
3500
4000
1
0.5
0
0
500
1000
1500
2000
2500
3000
3500
4000
1
0.5
0
0
500
1000
1500
2000
2500
3000
3500
4000
Frequency (Hz)
FIGURE 10.14
Spectrum for the input signal, unknown system output, and the adaptive filter output.
sum ¼ sum þ w(i)*x(m-i);
end
y(m)
¼
sum;
e(m)
¼
d(m)-y(m);
for i
¼
1:1:21
w(i)
¼
w(i)
þ
2*mu*e(m)*x(m-i);
end
end
% Calculate the single-sided amplitude spectrum for the input
X ¼ 2*abs(fft(x))/length(x);X(1) ¼ X(1)/2;
% Calculate the single-sided amplitude spectrum for the unknown system output
D ¼ 2*abs(fft(d))/length(d);D(1) ¼ D(1)/2;
% Calculate the single-sided amplitude spectrum for the adaptive filter output
Y ¼ 2*abs(fft(y))/length(y);Y(1) ¼ Y(1)/2;
% Map the frequency index to its frequency in Hz
f ¼ [0:1:length(x)/2]*fs/length(x);
% Plot signals and spectra
subplot(4,1,1), plot(x);grid; axis([0 length(x) -3 3]);
ylabel( ' System input ' );
subplot(4,1,2), plot(d);grid; axis([0 length(x) -1.5 1.5]);
ylabel( ' System output ' );
subplot(4,1,3),plot(y);grid; axis([0 length(y) -1.5 1.5]);
 
Search WWH ::




Custom Search