Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

FIR filter design Using Equiripple method, Exercises of Digital Signal Processing

How design FIR filter design using different technique

Typology: Exercises

2018/2019

Uploaded on 04/04/2019

muthe-muralikrishna
muthe-muralikrishna 🇮🇳

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FIR digiral filter Using FREQUENCY SAMPLING
9(a) LPF
M=63;
Wp=0.5*pi;%the number of samples and the passband cutoff frequency
m=0:(M+1)/2;
Wm=2*pi*m./(M+1);%the sampling points and the stopband cutoff frequency
mtr=floor(Wp*(M+1)/(2*pi))+2;%round to negative part,i.e.floor(3.5)=3;floor
(-3.2)=-4
Ad=[Wm<=Wp];
Ad(mtr)=0.38;
Hd=Ad.*exp(-j*0.5*M*Wm);%define frequency-domain sampling vector H(k)
Hd=[Hd conj(fliplr(Hd(2:(M+1)/2)))];
%fliplr is to realize the fliplr of matrix and conj
h=real(ifft(Hd));% h(n)=IDFT[H(k)
w=linspace(0,pi,1000);%get 1000 row vectors between 0 and pi
H=freqz(h,[1],w);%the amplitude -frequency characteristic diagram of the
filter
figure(1)
plot(w/pi,20*log10(abs(H)));%parameters are respectively the normalized
frequency and amplitude
xlabel('the normailzed frequency');
ylabel('gian/dB');
title('The gain response of lowpass filter');
axis([0 1 -50 0.5]);
9(b) HPF
M=32;%the number of samples
Wp=0.6*pi;%passband cutoff frequency
m=0:M/2;%the sampling points
Wm=2*pi*m./(M+1);%stopband cutoff frequency
mtr=ceil(Wp*(M+1)/(2*pi));%round to positive part,i.e.ceil(3.5)=4;ceil
(-3.2)=-3;
Ad=[Wm>=Wp];
Ad(mtr)=0.38;
Hd=Ad.*exp(-j*0.5*M*Wm);%define frequency-domain sampling vector H(k))
Hd=[Hd conj(fliplr(Hd(2:M/2+1)))];
%fliplr is to realize the fliplr of matrix and conj is the conjugate
h=real(ifft(Hd));%h(n)=IDFT[H(k)]
w=linspace(0,pi,1000);%get 1000 row vectors between 0 and pi
H=freqz(h,[1],w);%the amplitude -frequency characteristic diagram of the
filter
figure(1)
plot(w/pi,20*log10(abs(H)));%parameters are respectively the noemalized
frequency and amplitude
xlabel('the normailzed frequency');
ylabel('gian/dB');
title('The gain response of highpass filter');
axis([0 1 -50 0]);
pf2

Partial preview of the text

Download FIR filter design Using Equiripple method and more Exercises Digital Signal Processing in PDF only on Docsity!

FIR digiral filter Using FREQUENCY SAMPLING

9(a) LPF

M=63;

Wp=0.5pi;%the number of samples and the passband cutoff frequency m=0:(M+1)/2; Wm=2pim./(M+1);%the sampling points and the stopband cutoff frequency mtr=floor(Wp(M+1)/(2pi))+2;%round to negative part,i.e.floor(3.5)=3;floor (-3.2)=- Ad=[Wm<=Wp]; Ad(mtr)=0.38; Hd=Ad.exp(-j0.5MWm);%define frequency-domain sampling vector H(k) Hd=[Hd conj(fliplr(Hd(2:(M+1)/2)))]; %fliplr is to realize the fliplr of matrix and conj h=real(ifft(Hd));% h(n)=IDFT[H(k) w=linspace(0,pi,1000);%get 1000 row vectors between 0 and pi H=freqz(h,[1],w);%the amplitude -frequency characteristic diagram of the filter figure(1) plot(w/pi,20log10(abs(H)));%parameters are respectively the normalized frequency and amplitude xlabel('the normailzed frequency'); ylabel('gian/dB'); title('The gain response of lowpass filter'); axis([0 1 -50 0.5]);

9(b) HPF

M=32;%the number of samples Wp=0.6pi;%passband cutoff frequency m=0:M/2;%the sampling points Wm=2pim./(M+1);%stopband cutoff frequency mtr=ceil(Wp(M+1)/(2pi));%round to positive part,i.e.ceil(3.5)=4;ceil (-3.2)=-3; Ad=[Wm>=Wp]; Ad(mtr)=0.38; Hd=Ad.exp(-j0.5MWm);%define frequency-domain sampling vector H(k)) Hd=[Hd conj(fliplr(Hd(2:M/2+1)))]; %fliplr is to realize the fliplr of matrix and conj is the conjugate h=real(ifft(Hd));%h(n)=IDFT[H(k)] w=linspace(0,pi,1000);%get 1000 row vectors between 0 and pi H=freqz(h,[1],w);%the amplitude -frequency characteristic diagram of the filter figure(1) plot(w/pi,20log10(abs(H)));%parameters are respectively the noemalized frequency and amplitude xlabel('the normailzed frequency'); ylabel('gian/dB'); title('The gain response of highpass filter'); axis([0 1 -50 0]);

10.(a). Design equiripple lowpass filter using function Remez

fs=2000; %the sample frequency

rp=3; %passband ripple

rs=40; %stopband ripple

f=[500 600]; %cutoff frequency

a=[1 0]; %desired amplitude

dev=[(10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)];

[n,fo,ao,w]=remezord(f,a,dev,fs);

b=remez(n,fo,ao,w);

figure(1)

freqz(b,1,1024,fs);

10.(b) Design equiripple band pass filter using function Remez

fs=2000; %the sample frequency

rp=3; %passband ripple

rs=40; %stopband ripple

f=[200 300 600 700]; %cutoff frequency

a=[0 1 0]; %desired amplitude

dev=[10^(-rs/20) (10^(rp/20)-1)/(10^(rp/20)+1) 10^(-rs/20)];

[n,fo,ao,w]=remezord(f,a,dev,fs);

b=remez(n,fo,ao,w);

figure(1)

freqz(b,1,1024,fs);