clc; 1.8 Design a butterworth analog bandstop filter with specifications fp1 35 fp2 215 fs1 100 fs2 150 rp =-3db rs=-15db clear all; close all; % ap=-3;%%db % as=-40;%%db % fp=1000;%%Hz % fs=2000;%%Hz ap=input('Enter the pass band ripple (in dB)'); as=input('Enter the stop band ripple (in dB)'); fp1=input('Enter the lower pass band frequency (in Hz)fp1='); fp2=input('Enter the upper pass band frequency (in Hz)fp2='); fs1=input('Enter the lower stop band frequency (in Hz)fs1='); fs2=input('Enter the upper stop band frequency (in Hz)fs2='); op1=2*pi*fp1; %%angular freq in rad/sec op2=2*pi*fp2; %%angular freq in rad/sec os1=2*pi*fs1; %%angular freq in rad/sec os2=2*pi*fs2; %%angular freq in rad/sec op=[op1 op2]; os=[os1 os2]; [N oc]=buttord(op,os,ap,as,'s'); disp('Orderofthefilter,N='); disp(N); % oc=op/((10^(-ap/10)-1)^(1/(2*N))); %or % oc=or/((10^(-as/10)-1)^(1/(2*N))); disp('Cutoff freq,oc='); disp(oc); Mohammed Zaki Salman Pes2201800 186 ece 4 A [b,a]=butter(N,oc,'stop','s'); fr=0:100:4000; wr=2*pi*fr; [H,w]=freqs(b,a,wr); f=w/(2*pi); H_mag=20*log10(abs(H)); figure; plot(f,H_mag); grid on; xlabel('Frequency in Hz'); ylabel('Magnitude in dB'); title('Magnitude Response'); Transferfunc=tf(b,a) o/p: Orderofthefilter,N= 2 Cutoff freq,oc= 1.0e+03 * 0.4841 1.2232 Transferfunc = s^4 + 1.184e06 s^2 + 3.507e11 ----------------------------------------------------- s^4 + 1045 s^3 + 1.731e06 s^2 + 6.189e08 s + 3.507e11 Continuous-time transfer function.