EXPERIMENT 12: Butterworth Digital LPF: If Else
EXPERIMENT 12: Butterworth Digital LPF: If Else
SAI VIKRAM
08621A0446
ws=input('enter the stopband frequency'); rp=input('enter the passband attenuation'); rs=input('enter the stopband attenuation'); fs=input('enter the normalized frequency'); w1=2*wp/fs; w2=2*ws/fs; if (wp>ws) error('For LFP wp should be less than ws'); else [n,wn]=buttord(w1,w2,rp,rs,'s') [b,a]=butter(n,wn,'s') w=0:0.01:pi; [b1,a1]= bilinear(b,a,2); [h,omega]=freqz(b1,a1,w); gain=20*log(abs(h)); an=angle(h); subplot(2,1,1) plot(omega/pi,gain); grid title('magnitude plot'); xlabel('normalized frequency'); ylabel('gain in db'); subplot(2,1,2) plot(omega/pi,an); title('phase plot'); xlabel('normalized frequency'); ylabel('phase angle'); end
31 4th Year,ECE-A DSP LAB
S.SAI VIKRAM
08621A0446
INPUT:enter the passband frequency600 enter the stopband frequency700 enter the passband attenuation2 enter the stopband attenuation10 enter the normalized frequency1000 OUTPUT:n=9 wn =1.2391 b = [0 0 0 0 0 0 0 0 0 6.8870] a = [1.0000 7.1358 25.4600 59.2910 98.9844 122.6539 112.8061 74.3758 32.0071 6.8870] WAVEFORM:-
RESULT:The magnitude and phase response characteristics of digital low pass butter worth filter are computed using MATLAB.
S.SAI VIKRAM
08621A0446
S.SAI VIKRAM
08621A0446
INPUT:enter the passband frequency700 enter the stopband frequency200 enter the passband attenuation2 enter the stopband attenuation10 enter the normalized frequency1000 OUTPUT:n=2 wn = 0.6928 b = [1 0 0] a = [1.0000 0.9798 WAVEFORM:-
0.4800]
RESULT:The magnitude and phase response characteristics of digital high pass butter worth filter are computed using MATLAB.