In: Electrical Engineering
Algorithm
Enter the pass band ripple (rp) and stop band ripple (rs).
Enter the pass band...
Algorithm
- Enter the pass band ripple (rp) and stop band ripple (rs).
- Enter the pass band frequency (wp) and stop band frequency
(ws).
- Get the sampling frequency (fs).
- Calculate normalized pass band frequency, and normalized stop
band frequency w1 and w2
respectively.
w1 = 2 * wp
/fs
w2 = 2 * ws /fs
- Make use of the following function to calculate order of
filter
Butterworth filter
order
[n,wn]=buttord(w1,w2,rp,rs)
- Design an nth order digital lowpass Butterworth
filter using the following statements. Butterworth filter [b,
a]=butter (n, wn)
OR
Design an nth order digital
high pass Butterworth filter using the following statement.
Butterworth filter [b,a]=butter (n, wn,’high’)
- Find the digital frequency response of the filter by using
‘freqz( )’ function
[H,w]=freqz(b,a,512,fs)
- Calculate the magnitude of the frequency response in decibels
(dB)
mag=20*log10 (abs (H))
- Plot the magnitude response [magnitude in dBversus normalized
frequency (Hz)]
- Calculate the phase response using an = angle (H)
- Plot the phase response [phase in radians Vs normalized
frequency (Hz)]
Program
Output