You are on page 1of 2

BUTTERWORTH HIGH PASS FILTER

clc; close all; clear all; format long; rp=input('enter the ripple factor in pass band'); rs=input('enter the riple factor in stop band'); wp=input('enter the pass band frequency'); ws=input('enter the stop band frequncy'); fs=input('enter the sampling frequency'); w1=2*wp/fs; w2=2*ws/fs; [n,wn]=buttord(w1,w2,rp,rs,'s'); [b,a]=butter(n,wn,'high','s'); w=0:0.01:pi; [h,om]=freqz(b,a,w); m=20.*log10(abs(h)); an=angle(h); subplot(2,1,1); plot(om/pi,m); ylabel('gain'); xlabel('(a)normalised frequency'); subplot(2,1,2); plot(om/pi,an); xlabel('(b)normalised frequency'); ylabel('phase in radian');

OUTPUT:
enter the ripple factor in pass band.01 enter the riple factor in stop band20 enter the pass band frequency1000 enter the stop band frequency5000frequncy10000 enter the sampling

GRAPH:
0

-10 gain -20 -30 0

0.1

0.2

0.3

0.4 0.5 0.6 0.7 (a)normalised frequency

0.8

0.9

4 phase in radian 2 0 -2 -4

0.1

0.2

0.3

0.4 0.5 0.6 0.7 (b)normalised frequency

0.8

0.9

You might also like