DSP Derivative
Filter with Hann Window
Matlab Tutorial
This DSP Matlab Tutorial is a project I made about a year ago that
is a simple DSP
Derivative filter. The coefficients have been generated manually
and the rest of
the Matlab code is plotting the results in the time domain as well
as the frequency
domain. The filter is also windowed with a Hann window... Courtesy
of Nicefarts :)
d1=[1/5 -1/4 1/3 -1/2 1 0 -1 1/2 -1/3 1/4 -1/5];
d2=[-1/10 1/9 -1/8 1/7 -1/6 1/5 -1/4 1/3 -1/2 1 0 -1 1/2 -1/3 1/4
-1/5 1/6 -1/7 1/8 -1/9 1/10];
w1=hann(11);
w2=hann(21);
h1=d1.*w1';
h2=d2.*w2';
%Plot 11-tap derivative function, window and windwed function.
figure(1)
subplot(3,1,1)
stem(d1)
title('11-tap Derivative function.')
subplot(3,1,2)
stem(w1)
title('11-tap Hann Window')
subplot(3,1,3)
stem(h1)
title('11-tap transfer function')
%Plot Frequency Response of 11-tap derivative.
figure(2)
subplot(2,1,1)
hold
plot((-.5:1/1024:.5-1/1024), fftshift(abs(fft(d1,1024))));
plot([-.5 0 .5], [pi 0 pi], 'r');
hold off
title('Frequency Response of 11-Tap Derivative function.')
subplot(2,1,2)
hold
plot((-.5:1/1024:.5-1/1024), fftshift(abs(fft(h1,1024))));
plot([-.5 0 .5], [pi 0 pi], 'r');
hold off
title('Frequency Response of 11-Tap Windowed Derivative function.')
hold off
%Plot 21-tap derivative function, window and windwed function.
figure(3)
subplot(3,1,1)
stem(d2)
title('21-tap Derivative function.')
subplot(3,1,2)
stem(w2)
title('21-tap Hann Window')
subplot(3,1,3)
stem(h2)
title('21-tap transfer function')
%Plot Frequency Response of 21-tap derivative.
figure(4)
subplot(2,1,1)
hold
plot((-.5:1/1024:.5-1/1024), fftshift(abs(fft(d2,1024))));
plot([-.5 0 .5], [pi 0 pi], 'r');
hold off
title('Frequency Response of 21-Tap Derivative function.')
subplot(2,1,2)
hold
plot((-.5:1/1024:.5-1/1024), fftshift(abs(fft(h2,1024))));
plot([-.5 0 .5], [pi 0 pi], 'r');
hold off
title('Frequency Response of 21-Tap Windowed Derivative function.')
hold off
DSP Products
Derivative
filter simple explanation
Related
C++
Bubble Sort Algorithm
Topics
Tech
Business Computer
Engineering Electrical
Engineering Selected
Topics |