Consider the following specification for an ANALOG low pass
     Consider the following specification for an ANALOG low pass filter.  maximum deviation from unity gain in the passband of 0.4dB  minimum attenuation in the stop band of 70dB  Passband edge: 400Hz.  Stopband edge 500Hz  Find the lowest order Butterworth filter that meets this specification. You must use the Matlab functions buttap and 1p21p to compute the transfer function and plot the analog magnitude response and verify that you have met the specification. Also plot the poles and zeros and the impulse response.  Find the lowest order Chebyshev filter that meets this specification. You must use the Matlab functions cheblap and 1p21p to compute the transfer function and plot the analog magnitude response and verify that you have met the specification. Also plot the poles and zeros and the impulse response. 
  
  Solution
Wp=400/pi %pass band freq Normalized
 Ws=500/pi %Stop band freq Normalized
 Rp=0.4;
 Rs=70;
 %for butterworth filter
 [n,Wn] = buttord(Wp,Ws,Rp,Rs,\'s\') ;
 [z p k]=buttap(n);
 [num,den]=lp2lp(k,p,Wn);
 figure(1)
 freqs(num,den);
 figure(2)
 impz(num,den);
 %for cheby filter
 [n1,Wn1] = cheb1ord(Wp,Ws,Rp,Rs,\'s\') ;
 [z1 p1 k1]=cheb1ap(n);
 [num,den]=lp2lp(k1,p1,Wn1);
 figure(3)
 freqs(num,den);
 figure(4)
 impz(num,den);

