Thursday, 24 April 2014

                        DSP PRACTICAL

                        

Q:Design an low pass fir filter using hanning window of order 11 having following specification:
pass band cut off frequency=250 Hz
sampling frequency=1000 Hz
fp=250 Hz
Fs=1000 Hz

PROGRAM:
clc
clear all;
close all;
syms w
H=input('enter value of H');
N=input('order of filter');
a=input('enter lower limit');
b=input('enter upper limit');
hd=0;
for n=1:N
    hd(n)=(1/(2*pi))*int(H*exp(j*w*(n-1)),a,b)
end
h=hd.*rishhann(N)
figure(1)
plot(h)
figure(2)
freqz(h)
pause
a=6

FUNCTION WINDOW:
PROGRAM1:
function  [w] = rishhamm(N)
w=0;
for n=1:N
w(n)=.54-.46*cos(2*pi*(n-1)/(N-1))
end
end

PROGRAM 2:
function [w] = rishhann(N)
w=0;
for n=1:N
    w(n)=.5-.5*cos(2*pi*(n-1)/(N-1))
end
end
PROGRAM 3:
function [w] = rishrect(N)
w=0;
for n=1:N
    w(n)=1                        
end
end

OUTPUT:
enter value of Hexp(-5*j*w)
order of filter11
enter lower limit-1.57
enter upper limit1.57

hd =

    0.0637


hd =

    0.0637   -0.0003


hd =

    0.0637   -0.0003   -0.1061


hd =

    0.0637   -0.0003   -0.1061    0.0003


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997    0.3183


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997    0.3183    0.0003


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997    0.3183    0.0003   -0.1061


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997    0.3183    0.0003   -0.1061   -0.0003


hd =

    0.0637   -0.0003   -0.1061    0.0003    0.3183    0.4997    0.3183    0.0003   -0.1061   -0.0003    0.0637


w =

     0


w =

         0    0.0955


w =

         0    0.0955    0.3455


w =

         0    0.0955    0.3455    0.6545


w =

         0    0.0955    0.3455    0.6545    0.9045


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000    0.9045


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000    0.9045    0.6545


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000    0.9045    0.6545    0.3455


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000    0.9045    0.6545    0.3455    0.0955


w =

         0    0.0955    0.3455    0.6545    0.9045    1.0000    0.9045    0.6545    0.3455    0.0955         0


h =

         0   -0.0000   -0.0367    0.0002    0.2879    0.4997    0.2879    0.0002   -0.0367   -0.0000         0










No comments:

Post a Comment