Question

6. MATLAB problem: A filter has the following specifications: Pass band edge = 0.3π. Stop band...

6. MATLAB problem:

A filter has the following specifications:

Pass band edge = 0.3π.

Stop band edge = 0.5π. 20log10(?????????=?????) = - 40 dB.

Design this filter using various IIR and FIR methods using MATLAB. Make a "brief" statement comparing the designs.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

FIR design

clc;close all;clear all;
wp=0.3*pi
ws=0.5*pi
wc=(wp+ws)/2
%using Hanning window
N=round(8*pi/(ws-wp));
M=N+1;
n=0:1:M-1;
%For Lpf, the desired impulse response is
alpha=(M-1)/2;
hd=(sin(wc*(n-alpha)))./(pi*(n-alpha))
hd(alpha+1)=wc/pi;
wh=hanning(M)';
h=hd.*wh;
%Magnitude response
w=0:0.01*pi:pi
[H,w]=freqz(h,[1],w)

figure;
subplot(221)
plot(w/pi,20*log10(abs(H)),'r')
title('Magnitude response |H(w)| -FiR Hanning window')
xlabel('w/pi')
ylabel('|H(exp(jw)|');grid;

subplot(222)
plot(w/pi,angle(H),'g')
title('phase response |H(w)|')
xlabel('w/pi')
ylabel('|H(exp(jw)|')

%Hamming window
wh=hamming(M)'
h=hd.*wh;
[H,w]=freqz(h,[1],w)

subplot(223)
plot(w/pi,20*log10(abs(H)),'m')
title('Magnitude response |H(w)| -FiR Hamming window')
xlabel('w/pi')
ylabel('|H(exp(jw)|');grid;

subplot(224)
plot(w/pi,angle(H),'g')
title('Phase response |H(w)|')
xlabel('w/pi')
ylabel('|H(exp(jw)|')

Magnitude response |H(w)| -FiR Hanning window phase response |H(w)|| (MI)dxəhl |H(exp(jw) my 0 0.2 0.8 1 0.4 0.6 w/pi 0 0.2 0

Observation:

For the same order M=41, the hamming window provides better attenuation than hanning window.

Both provides the same amount of transition width.

_____________________________________________________________________________

IIR design:

clc;
close all;
clear all;
%Specifications
Rs=40
wp=0.3
ws=0.5
Rp=0.5%assumption
%Butterworth filter
[N,wc]=buttord(wp,ws,Rp,Rs)
[b,a]=butter(N,wc)
figure;
freqz(b,a)
%chebyshev Filter 1
[N,wp] = cheb1ord(wp,ws,Rp,Rs)
[b,a]=cheby1(N,Rp,wp)
figure;
freqz(b,a)
%Elliptic Filter
[N,wp] = ellipord(wp,ws,Rp,Rs)
[b,a] = ellip(N,Rp,Rs,wp)
figure;
freqz(b,a)

Butterworth filter:

Magnitude (dB) 0.2 0.8 0.4 0.6 Normalized Frequency (xn rad/sample) Phase (degrees) -800 -1000 0.2 0.8 0.4 0.6 Normalized Fre

Chebyshev 1:

Magnitude (dB) 0.2 0.8 0.4 0.6 Normalized Frequency (xn rad/sample) Phase (degrees) -400 -500 R 0.2 0.8 0.4 0.6 Normalized Fr

elliptic:

Magnitude (dB) 0.2 0.8 0.4 0.6 Normalized Frequency (xn rad/sample) Phase (degrees) 0.8 0.2 0.4 0.6 Normalized Frequency (xn

Add a comment
Know the answer?
Add Answer to:
6. MATLAB problem: A filter has the following specifications: Pass band edge = 0.3π. Stop band...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT