You are on page 1of 2

VIRTUAL LAB(15/03/2018)

Code forButterworth:
clc
clear all
Hp=0.707
Hs=0.2
alphap=20*log(1/Hp)
alphas=20*log(1/Hs)
fp=0.45/(2)
fs=0.65/(2)
F=1/1.0
omp=2*fp/F
oms=2*fs/F
[n,wn]=buttord(omp,oms,alphap,alphas)
[b,a]=butter(n,wn)
w=0:0.1:pi;
[h,om]=freqz(b,a,w,'whole');
m=abs(h)
an=angle(h)
subplot(2,1,1), plot(om/pi,20*log(m));grid;
ylabel('Gain in dB');
xlabel('Normalized frequency');
subplot(2,1,2), plot(om/pi,an);grid;
ylabel('Phase in Radians');
xlabel('Normalized frequency')

You might also like