

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
How design FIR filter design using different technique
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!
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]);
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]);