Bonjour,
pourriez vous m'aidez à faire la synthèse d'un filtre RII avec le filtre de butterworth?
voilà mon script
% modèle de chebyshev1
almax=1;
% : almax : atténuation maximale dans la bande passante (dB)
almin=15;
% : almin : atténuation minimale dans la bande atténuée (dB)
wp=0.2*pi;
ws=0.3*pi;
fil=1;
%(ou fil=0 selon le type de filtre) , fil : type de filtre (1=butterworth,0=chebyshev)
ws=2*tan(ws/2);
wp=2*tan(wp/2);
% synthèse par un modèle de butterworth
epsilon=sqrt(10^(0.1*almax)-1) ;
num=sqrt(10^(0.1*almin)-1)/epsilon ;
N=ceil(acosh(num)/acosh(ws/wp));
whp=wp*cosh((1/N)*acosh(1/epsilon)) ;
whp=2*atan(whp/2) ;
wn=whp/pi;
Rp=almax ;
[b,a]=butter(N,wn) ;
%[b,a] : coefficients du numérateur/dénominateur
[H,w]=freqz(b,a,512);
subplot 221;
zplane(b,a)
subplot 222;
mag=abs(H);
plot(w/pi,mag)
ylabel('amplitude');
xlabel('fréquence (Hz)');
axis([0 1 0 1.1*max(mag)]) ; grid
thresh1=[-almax*ones(1,length(mag))];
thresh2=[- almin*ones(1,length(mag))];
subplot 223;plot(w/pi,20*log10(mag), w/pi, thresh1,w/pi, thresh2 )
ylabel('amplitude (dB)') ;axis([0 .999 -1.1*almin 0]) ;xlabel('fréquence (Hz)') ; grid
phase=unwrap(angle(H)) ;
subplot 224;plot(w/pi,phase);ylabel('phase(rad)') ; xlabel('fréquence (Hz)') ; grid