Digital Signal Processing Reference
In-Depth Information
0.1
0.05
0
0
500
1000
1500
2000
2500
3000
3500
4000
0.15
0.1
0.05
0
0
500
1000
1500
2000
2500
3000
3500
4000
0.15
0.1
0.05
0
0
500
1000
1500
2000
2500
3000
3500
4000
Frequency (Hz)
FIGURE 10.10B
Spectrum for original speech, corrupted speech, and clean speech.
t ¼ t/fs;
% Convert indices to time instant
x ¼ randn(1,length(wen));
% Generate random noise
n
¼
filter([ 0 0 0 0 0 0.5 ],1,x);
% Generate the corruption noise
d
¼
wen
þ
n;
% Generate signal plus noise
mu
¼
0.01;
% Initialize step size
w
¼
zeros(1,21);
% Initialize adaptive filter coefficients
y
¼
zeros(1,length(t));
% Initialize the adaptive filter output array
e
y; % Initialize the output array
% Adaptive filtering using LMS algorithm
for m ¼ 22:1:length(t)-1
sum ¼ 0;
for i ¼ 1:1:21
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 original signal
WEN ¼ 2*abs(fft(wen))/length(wen);WEN(1) ¼ WEN(1)/2;
¼
Search WWH ::




Custom Search