clear all;clc; % Filtre de Butterworth N=6 wc=0.7032 [b1 a1]=butter(N,wc/pi); figure(1); freqz(b1,a1) axis([0 1 -20 0]) %Filtrage numérique: t=0.001:0.001:1; x=sin(2*pi*20*t)+cos(2*pi*500*t); dataIn=x'+0.1*randn(1000,1); dataOut=filter(b1,a1,dataIn); figure(2); subplot(2,1,1);plot(1:1000,dataIn); legend('Signal bruité');grid; subplot(2,1,2);plot(1:1000,dataOut,'r'); legend('Signal filtré');grid; % Filtre de Chebyshev N=4; ep=0.50885; wc=0.6283; [b2,a2] = cheby1(N,ep,wc/pi); figure(3); freqz(b2,a2); axis([0 1 -30 0]) %Filtrage numérique t=0.001:0.001:1; x=sin(2*pi*20*t)+cos(2*pi*500*t); dataIn=x'+0.1*randn(1000,1); dataOut=filter(b2,a2,dataIn); figure(4); subplot(2,1,1);plot(1:1000,dataIn); legend('Signal bruité');grid; subplot(2,1,2);plot(1:1000,dataOut,'r'); legend('Signal filtré');grid; %Comparaison entre les deux filtres figure(5); freqz(b1,a1); hold on; freqz(b2,a2);axis([0 1 -20 0]) legend('Réponse de Butterworth','Réponse de Chebyshev');