25-Tap Differentiator Using Rectangular, Bartlett and Hamming Window EX - NO: Date
25-Tap Differentiator Using Rectangular, Bartlett and Hamming Window EX - NO: Date
25-Tap Differentiator Using Rectangular, Bartlett and Hamming Window EX - NO: Date
HAMMING WINDOW
EX.NO:
DATE:
AIM:
APPARATUS REQUIRED:
MATLAB(Version 7.1)
ALGORITHM:
clear all
N=25;a=(N-1)/2;eps=.001;
n=0:1:N-1;
hd=cos(pi*(n-a))./(pi*(n-a));hd(a+1)=0;
wr=boxcar(N);
hn=hd.*wr';
w=0:.01:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
hold on
wt=bartlett(N);
hn=hd.*wt';
w=0:.01:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h));
hold on
wh=hamming(N);
hn=hd.*wh';
w=0:.01:pi;
h=freqz(hn,1,w);
plot(w/pi,abs(h),'-.');grid;
xlabel('Normalised frequency\omega/\pi');
ylabel('Magnitude');
hold off
OUTPUT:
1.4
1.2
0.8
Magnitude
0.6
0.4
0.2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency /
RESULT:
Thus the 25-tap differentiator is designed using Rectangular, Bartlett and Hamming
windows.
FIR LOW PASS FILTER USING FREQUENCY SAMPLING METHOD
EX.NO:
DATE:
AIM:
To design a FIR low pass filter with cut off frequency 0.5pi using frequency sampling
method.
APPARATUS REQUIRED:
MATLAB(Version 7.1)
ALGORITHM:
clear all
N=33;
alpha=(N-1)/2;
Hrk=[ones(1,9),zeros(1,16),ones(1,8)];
k1=0:(N-1)/2;k2=(N+1)/2:N-1;
theetak=[(-alpha*(2*pi)/N)*k1,(alpha*(2*pi)/N)*(N-k2)];
Hk=Hrk.*(exp(i*theetak));
w=0:.01:pi;
hn=real(ifft(Hk,N))
H=freqz(hn,1,w);
plot(w/pi,20*log10(abs(H)));grid;
hold on
Hrk=[ones(1,9),0.5,zeros(1,14),0.5,ones(1,8)];
k1=0:(N-1)/2;k2=(N+1)/2:N-1;
theetak=[(-alpha*(2*pi)/N)*k1,(alpha*(2*pi)/N)*(N-k2)];
Hk=Hrk.*(exp(i*theetak));
hn=real(ifft(Hk,N));
w=0:.01:pi;
H=freqz(hn,1,w);
plot(w/pi,20*log10(abs(H)),'.');grid;
ylabel('Magnitude in db'),xlabel('Normalised frequency\omega/\pi')
hold off
OUTPUT:
10
-10
-20
Magnitude in db
-30
-40
-50
-60
-70
-80
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalised frequency /
\
RESULT:
Thus the FIR low pass filter with cut off frequency .5pi using frequency sampling is
designed.