function [z,p,gain] = invcheby (n,ap,as) % INVCHEBY - Chebyshev type II analog lowpass filter prototype. % [z,p,gain] = invcheby (n,ap,as) returns the zeros, poles and gain % of an normalized prototype type II Chebyshev analog lowpass filter % with ap decibels of ripple in the passband, as decibels of ripple % in the stopband and oms is normalized frequency of the start of the % stopband. Type II Chebyshev filters are maximally flat in the passband. % % Author(s): M. Laipert, M. Vlcek, J. Vrbata % Programmed by Jan Vrbata, 1999-2000 % This is a version for GNU OCTAVE 2.0.4 %format long; opt=0; eps=sqrt(10^(0.1*ap)-1); k1=1/sqrt((10^(0.1*as)-1)/(10^(0.1*ap)-1)); k=1/cosh(acosh(1/k1)/n); oms=1/k; if (ceil(n/2)==n/2) m=floor(n/2); else m=floor((n-1)/2); end pom=sqrt(1+((eps^2)/(k1^2))); a=0.5*((pom+eps/k1)^(1/n)-(pom-eps/k1)^(1/n)); b=0.5*((pom+eps/k1)^(1/n)+(pom-eps/k1)^(1/n)); for f=1:m; pom=1/(k*cos(((2*f-1)*pi)/(2*n))); z(f)=0+pom*i; if (ceil(n/2)~=n/2) z(n-f)=0-pom*i; else z(n-f+1)=0-pom*i; end pom=(a^2)*(sin(((2*f-1)*pi)/(2*n)))^2+(b^2)*(cos(((2*f-1)*pi)/(2*n)))^2; alfa=-1*(a*sin(((2*f-1)*pi)/(2*n)))/(k*pom); beta=(b*cos(((2*f-1)*pi)/(2*n)))/(k*pom); p(f)=alfa-beta*i; p(n-f+1)=alfa+beta*i; end; if (ceil(n/2)~=n/2) p(m+1)=-1/(a*k); %z(m+1)=0; gain=(n*k1)/(eps*k); else gain=1/sqrt(1+(eps^2)/(k1^2)); end;