Vous êtes sur la page 1sur 16

B/Etude pratique

Filre RIF :
Programme avec matlab :

Filtre passe bas :


clear all;
close all;
fe=1000;
f0=80;
fc=input('tapez la frequence de coupure fc=');
N=256;
M=512;
%calcule de la reponse impusionelle h(k)
L=129;%nobre des echantiollons de h(k)
l=(-(L-1)/2:(L-1)/2);
h=((2*fc)/fe)*sinc(2*fc*l/fe);
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end;
y1=filter(h,1,x1);
y2=filter(h,1,x2);
y3=filter(h,1,x3);
%transformer de fourier de reponce impulsionnelle
fh=fftshift(abs(fft(h,M))),title('T F de reponce impulsionnelle');
figure(1);
subplot(321),plot(x1),title('x1');
subplot(322),plot(y1),title('y1');
subplot(323),plot(x2),title('x2');
subplot(324),plot(y2),title('y2');
subplot(325),plot(x3),title('x3');
subplot(326),plot(y3),title('y3');
%transformer de fourier des signaux et des filtres
fx1=fftshift(abs(fft(x1,M))),title('T F de x1');
fx2=fftshift(abs(fft(x2,M))),title('T F de x2');
fx3=fftshift(abs(fft(x3,M))),title('T F de x3');
fy1=fftshift(abs(fft(y1,M))),title('T F de y1');
fy2=fftshift(abs(fft(y2,M))),title('T F de y2');
fy3=fftshift(abs(fft(y3,M))),title('T F de y3');
figure(2);
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(fx1),title('fx1');
subplot(535),plot(fx2),title('fx2');
subplot(536),plot(fx3),title('fx3');
subplot(537),plot(fh),title('T F de reponce impulsionnelle');
subplot(538),plot(fh),title('T F de reponce impulsionnelle');
subplot(539),plot(fh),title('T F de reponce impulsionnelle');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(fy1),title('fy1');
subplot(5,3,14),plot(fy2),title('fy2');
subplot(5,3,15),plot(fy3),title('fy3'); %fc=400

La reprsentation graphique des signaux :

x1

1
0
-1

50

100

150
fx1

200

250

300

100
200
300
400
500
T F de reponce impulsionnelle

600

50

100

150
fx2

200

250

300

100

200

300
y1

400

500

600

100
200
300
400
500
T F de reponce impulsionnelle

600

50

100

100

150
fy1

200

250

300

-2

100

200

300
y2

400

500

600

100

200

300

400

500

Filtre passe haut :


Le programme :
clear all;

600

300

100
200
300
400
500
T F de reponce impulsionnelle

600

100

200

300
y3

400

500

600

50

100

150
fy3

200

250

300

100

200

300

400

500

600

50

100

150
fy2

200

250

300

-2
100

100
0

100

150
fx3

200

200

50

250

0
0

50

100

1
0

-1

50

100

-2

200

100

-1

x3

200

x2

50
0

100

200

300

400

500

600

close all;
fe=2000;
f0=80;
fc=input('tapez la frequence de coupure fc=');
fc2=input('tapez la frequence de coupure fc2=');
N=256;
M=512;
%calcule de la reponse impusionelle h(k)
L=129;%nobre des echantiollons de h(k)
l=(-(L-1)/2:(L-1)/2);
g=zeros(1,L); %g=peigne de diract passe tout
g(65)=1; %decalage jusqu'a 65
h=((2*fc)/fe)*sinc(2*fc*l/fe); %filter bas frequence de fc =100
h2=((2*fc2)/fe)*sinc(2*fc2*l/fe);%filter bas frequence de fc2 =300
h3=h2-h % filtre pass band
h4=g-h %filtre haut frequence
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end;
y1=filter(h4,1,x1);
y2=filter(h4,1,x2);
y3=filter(h4,1,x3);
%transformer de fourier de reponce impulsionnelle
fh4=fftshift(abs(fft(h4,M))),title('T F de reponce impulsionnelle');
figure(1);
subplot(321),plot(x1),title('x1');
subplot(322),plot(y1),title('y1');
subplot(323),plot(x2),title('x2');
subplot(324),plot(y2),title('y2');
subplot(325),plot(x3),title('x3');
subplot(326),plot(y3),title('y3');
%transformer de fourier des signaux et des filtres
fx1=fftshift(abs(fft(x1,M))),title('T F de x1');
fx2=fftshift(abs(fft(x2,M))),title('T F de x2');
fx3=fftshift(abs(fft(x3,M))),title('T F de x3');
fy1=fftshift(abs(fft(y1,M))),title('T F de y1');
fy2=fftshift(abs(fft(y2,M))),title('T F de y2');
fy3=fftshift(abs(fft(y3,M))),title('T F de y3');
figure(2);
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(fx1),title('fx1');
subplot(535),plot(fx2),title('fx2');
subplot(536),plot(fx3),title('fx3');
subplot(537),plot(fh4),title('T F de reponce impulsionnelle');
subplot(538),plot(fh4),title('T F de reponce impulsionnelle');
subplot(539),plot(fh4),title('T F de reponce impulsionnelle');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(fy1),title('fy1');
subplot(5,3,14),plot(fy2),title('fy2');
subplot(5,3,15),plot(fy3),title('fy3');

reprsentation graphique :

x1

1
0
-1

50

100

150
fx1

200

250

300

100 200 300 400 500


T F de reponce impulsionnelle

600

50

100

150
fx2

200

250

300

100

200

0.5

300
y1

400

500

600

100 200 300 400 500


T F de reponce impulsionnelle

600

50

100

150
fy1

200

250

300

-1

100

200

300
y2

400

500

600

100

200

300

400

500

600

300

100 200 300 400 500


T F de reponce impulsionnelle

600

100

200

300
y3

400

500

600

50

100

150
fy3

200

250

300

100

200

300

400

500

600

50

100

150
fy2

200

250

300

-1
20

20
0

100

150
fx3

200

40

250

0
0

50

100

1
0

-1

50

100

-0.5

200

100

-1

x3

200

x2

10
0

100

200

300

400

500

600

filtre passe bande :


le programme :
clear all;
close all;
fe=1000;
f0=80;
fc=input('tapez la frequence de coupure fc=');
fc2=input('tapez la frequence de coupure fc2=');
N=256;
M=512;
%calcule de la reponse impusionelle h(k)
L=129;%nobre des echantiollons de h(k)
l=(-(L-1)/2:(L-1)/2);
h=((2*fc)/fe)*sinc(2*fc*l/fe);
h2=((2*fc2)/fe)*sinc(2*fc2*l/fe);
h3=h2-h
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end;
y1=filter(h3,1,x1);
y2=filter(h3,1,x2);
y3=filter(h3,1,x3);
%transformer de fourier de reponce impulsionnelle
fh3=fftshift(abs(fft(h3,M))),title('T F de reponce impulsionnelle');
figure(1);
subplot(321),plot(x1),title('x1');
subplot(322),plot(y1),title('y1');
subplot(323),plot(x2),title('x2');
subplot(324),plot(y2),title('y2');
subplot(325),plot(x3),title('x3');
subplot(326),plot(y3),title('y3');
%transformer de fourier des signaux et des filtres
fx1=fftshift(abs(fft(x1,M))),title('T F de x1');
fx2=fftshift(abs(fft(x2,M))),title('T F de x2');
fx3=fftshift(abs(fft(x3,M))),title('T F de x3');
fy1=fftshift(abs(fft(y1,M))),title('T F de y1');
fy2=fftshift(abs(fft(y2,M))),title('T F de y2');
fy3=fftshift(abs(fft(y3,M))),title('T F de y3');
figure(2);
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(fx1),title('fx1');
subplot(535),plot(fx2),title('fx2');
subplot(536),plot(fx3),title('fx3');
subplot(537),plot(fh3),title('T F de reponce impulsionnelle');
subplot(538),plot(fh3),title('T F de reponce impulsionnelle');
subplot(539),plot(fh3),title('T F de reponce impulsionnelle');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(fy1),title('fy1');
subplot(5,3,14),plot(fy2),title('fy2');
subplot(5,3,15),plot(fy3),title('fy3'); %fc=400

reprsentation graphique :

x1

1
0
-1

50

100

150
fx1

200

250

300

50

100

150
fx2

200

250

300

100
200
300
400
500
T F de reponce impulsionnelle

600

100
200
300
400
500
T F de reponce impulsionnelle

600

100

200

0.5

300
y1

400

500

600

100

200

300
y2

400

500

600

50

100

150
fy1

200

250

300

-1

150
fx3

200

300

100
200
300
400
500
T F de reponce impulsionnelle

600

100

200

300
y3

400

500

600

50

100

150
fy3

200

250

300

100

200

300

400

500

600

0
0

50

100

50

150
fy2

200

250

300

-0.5
40

1
0

250

0.5

0
0

100

50

1
0

50

-1
100

100

-0.5

200

100

-1

x3

200

x2

20
0

100

200

300

400

500

600

100

200

300

400

500

600

Filtre coupe bande :


Le programme :
clear all;
close all;
fe=1000;
f0=80;
fc=input('tapez la frequence de coupure fc=');
fc2=input('tapez la frequence de coupure fc2=');
N=256;
M=512;
%calcule de la reponse impusionelle h(k)
L=129;%nobre des echantiollons de h(k)
l=(-(L-1)/2:(L-1)/2);
g=zeros(1,L); %g=peigne de diract =tou pas
g(65)=1; %decalage jusqu'a 65
h=((2*fc)/fe)*sinc(2*fc*l/fe); %filter bas frequence de fc =100
h2=((2*fc2)/fe)*sinc(2*fc2*l/fe);%filter bas frequence de fc2 =300
h3=h2-h % filtre pass band
h4=g-h %filtre haut frequence
h5=g-h3 %filtre coupe band
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end;
y1=filter(h5,1,x1);
y2=filter(h5,1,x2);
y3=filter(h5,1,x3);
%transformer de fourier de reponce impulsionnelle
fh5=fftshift(abs(fft(h5,M))),title('T F de reponce impulsionnelle');
figure(1);
subplot(321),plot(x1),title('x1');
subplot(322),plot(y1),title('y1');
subplot(323),plot(x2),title('x2');
subplot(324),plot(y2),title('y2');
subplot(325),plot(x3),title('x3');
subplot(326),plot(y3),title('y3');
%transformer de fourier des signaux et des filtres
fx1=fftshift(abs(fft(x1,M))),title('T F de x1');
fx2=fftshift(abs(fft(x2,M))),title('T F de x2');
fx3=fftshift(abs(fft(x3,M))),title('T F de x3');
fy1=fftshift(abs(fft(y1,M))),title('T F de y1');
fy2=fftshift(abs(fft(y2,M))),title('T F de y2');
fy3=fftshift(abs(fft(y3,M))),title('T F de y3');
figure(2);
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(fx1),title('fx1');
subplot(535),plot(fx2),title('fx2');
subplot(536),plot(fx3),title('fx3');
subplot(537),plot(fh5),title('T F de reponce impulsionnelle');
subplot(538),plot(fh5),title('T F de reponce impulsionnelle');
subplot(539),plot(fh5),title('T F de reponce impulsionnelle');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(fy1),title('fy1');
subplot(5,3,14),plot(fy2),title('fy2');

subplot(5,3,15),plot(fy3),title('fy3'); %fc=100 fc2=300

Reprsentation graphique :
x1

1
0
-1

50

100

150
fx1

200

250

300

100
200 300
400
500
T F de reponce impulsionnelle

600

50

100

150
fx2

200

250

300

100

200

300
y1

400

500

600

100
200
300
400
500
T F de reponce impulsionnelle

600

50

100

100

150
fy1

200

250

300

-2

100

200

300
y2

400

500

600

100

200

300

400

500

600

300

100
200
300
400
500
T F de reponce impulsionnelle

600

100

200

300
y3

400

500

600

50

100

150
fy3

200

250

300

100

200

300

400

500

600

50

100

150
fy2

200

250

300

-1
100

100
0

100

150
fx3

200

200

50

250

0
0

50

100

1
0

-1

50

100

-2

200

100

-1

x3

200

x2

50
0

100

200

300

400

500

600

Filre RII :
filtre basse bas :
le programme :
%tp5: filtrage RIF eT RII
%Chiheb Chihabeddine
%Guerroui Mohammed
%h(k)=2*fc/fe*sinc(2*fck/fe)
clear all;
close all;
fe=2000;
f0=50;
N=256;
M=512;
s=[-fe/2:fe/M:(fe/2)-1];
s1=[1:fe/M:(fe/2)-1];
fc1=input('tappez la frquence de coupure fc1=');
% calcule de la frquence impultionelle h(t)
L=129;% la longueure de h(t). le nombre d'echantillons
l=[(-L-1)/2:(L-1)/2];
%hpb1=(2*fc1/fe)*sinc(2*fc1*l/fe);
%hpb2=(2*fc2/fe)*sinc(2*fc2*l/fe);
Wn1=2*fc1/fe;% frquence de couppure ,normalise 1
Wn=[Wn1 ];
N1=8;
[B,A] = BUTTER(N1,Wn);
[H,W] = FREQZ(B,A,N,fe);
fh=abs(H);
%h=hpb2-hpb1;
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end
y1=filter(B,A,x1);
y2=filter(B,A,x2);
y3=filter(B,A,x3);
%transforme de fourier des signaux filtrs
fy11=(abs(fft(y1,M)));
fy1=fy11(1:M/2);
fy22=(abs(fft(y2,M)));
fy2=fy22(1:M/2);
fy33=(abs(fft(y3,M)));
fy3=fy33(1:M/2);
%transforme de fourier de la rponse impulsionnelle
%fh=fftshift(abs(fft(h,M)));
%transforme de signaux d'entr
fx11=(abs(fft(x1,M)));
fx1=fx11(1:M/2);
fx22=(abs(fft(x2,M)));
fx2=fx22(1:M/2);
fx33=(abs(fft(x3,M)));
fx3=fx33(1:M/2);
figure(1)

subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(s1,fx1),title('fx1');
subplot(535),plot(s1,fx2),title('fx2');
subplot(536),plot(s1,fx3),title('fx3');
subplot(537),plot(s1,fh),title('fh');
subplot(538),plot(s1,fh),title('fh');
subplot(539),plot(s1,fh),title('fh');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(s1,fy1),title('fy1');
subplot(5,3,14),plot(s1,fy2),title('fy2');
subplot(5,3,15),plot(s1,fy3),title('fy3');

reprsentation graphique :
x1

1
0
-1

50

100

150
fx1

200

250

300

200

400

fh

600

800

1000

50

100

150
fx2

200

250

300

200

400

y1

600

800

1000

200

400

fh

600

800

1000

50

100

200

150
fy1

200

250

300

-2

200

400

y2

600

800

1000

200

400

600

800

1000

200

400

200

400

50

100

150
fy2

200

250

300

-1

50

100

100

100
0

150
fx3

200

250

300

fh

600

800

1000

y3

600

800

1000

200

100

100

0
0

50

100

1
0

-1

50

100

-2

200

100

-1

x3

200

x2

150
fy3

200

250

300

50
0

200

400

600

800

1000

200

400

600

800

1000

Filtre passe bande :


Le programme :
%tp5: filtrage RIF eT RII
%Chiheb Chihabeddine
%Guerroui Mohammed
clear all;
close all;
fe=2000;
f0=50;
N=256;
M=512;
s=[-fe/2:fe/M:(fe/2)-1];
s1=[1:fe/M:(fe/2)-1];
fc1=input('tappez la frquence de coupure fc1=');
fc2=input('tappez la frquence de coupure fc2=');
% calcule de la frquence impultionelle h(t)
L=129;% la longueure de h(t). le nombre d'echantillons
l=[(-L-1)/2:(L-1)/2];
Wn1=2*fc1/fe;% frquence de couppure ,normalise 1
Wn2=2*fc2/fe;%frquence de couppure ,normalise 2
Wn=[Wn1 Wn2];
N1=8;
[B,A] = BUTTER(N1,Wn);
[H,W] = FREQZ(B,A,N,fe);
fh=abs(H);
%h=hpb2-hpb1;
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end
y1=filter(B,A,x1);
y2=filter(B,A,x2);
y3=filter(B,A,x3);
%transforme de fourier des signaux filtrs
fy11=(abs(fft(y1,M)));
fy1=fy11(1:M/2);
fy22=(abs(fft(y2,M)));
fy2=fy22(1:M/2);
fy33=(abs(fft(y3,M)));
fy3=fy33(1:M/2);
%transforme de fourier de la rponse impulsionnelle
%fh=fftshift(abs(fft(h,M)));
%transforme de signaux d'entr
fx11=(abs(fft(x1,M)));
fx1=fx11(1:M/2);
fx22=(abs(fft(x2,M)));
fx2=fx22(1:M/2);
fx33=(abs(fft(x3,M)));
fx3=fx33(1:M/2);
figure(1)
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');

subplot(534),plot(s1,fx1),title('fx1');
subplot(535),plot(s1,fx2),title('fx2');
subplot(536),plot(s1,fx3),title('fx3');
subplot(537),plot(s1,fh),title('fh');
subplot(538),plot(s1,fh),title('fh');
subplot(539),plot(s1,fh),title('fh');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(s1,fy1),title('fy1');
subplot(5,3,14),plot(s1,fy2),title('fy2');
subplot(5,3,15),plot(s1,fy3),title('fy3');

Reprsentation graphique :
x1

1
0
-1

50

100

150
fx1

200

250

300

50

100

150
fx2

200

250

300

200

400

fh

600

800

1000

200

400

fh

600

800

1000

200

400

0.5

y1

600

800

1000

200

400

y2

600

800

1000

50

100

150
fy1

200

250

300

-0.5

150
fx3

200

250

300

200

400

200

400

fh

600

800

1000

y3

600

800

1000

0
0

50

100

50

150
fy2

200

250

300

-0.5

50

100

40

2
0

0.5

0
0

100

0.5

50

1
0

50

-1
100

100

-0.5

200

100

-1

x3

200

x2

150
fy3

200

250

300

20
0

200

400

600

800

1000

200

400

600

800

1000

200

400

600

800

1000

Passe haut :
Le programme :
%tp5: filtrage RIF eT RII
%Chiheb Chihabeddine
%Guerroui Mohammed
clear all;
close all;
fe=2000;
f0=50;
N=256;
M=512;
s=[-fe/2:fe/M:(fe/2)-1];
s1=[1:fe/M:(fe/2)-1];
fc1=input('tappez la frquence de coupure fc1=');
% calcule de la frquence impultionelle h(t)
L=129;% la longueure de h(t). le nombre d'echantillons
l=[(-L-1)/2:(L-1)/2];
Wn1=2*fc1/fe;% frquence de couppure ,normalise 1
Wn=[Wn1 ];
N1=8;
[B,A] = BUTTER(N1,Wn,'high');
[H,W] = FREQZ(B,A,N,fe);
fh=abs(H);
%h=hpb2-hpb1;
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end
y1=filter(B,A,x1);
y2=filter(B,A,x2);
y3=filter(B,A,x3);
%transforme de fourier des signaux filtrs
fy11=(abs(fft(y1,M)));
fy1=fy11(1:M/2);
fy22=(abs(fft(y2,M)));
fy2=fy22(1:M/2);
fy33=(abs(fft(y3,M)));
fy3=fy33(1:M/2);
%transforme de signaux d'entr
fx11=(abs(fft(x1,M)));
fx1=fx11(1:M/2);
fx22=(abs(fft(x2,M)));
fx2=fx22(1:M/2);
fx33=(abs(fft(x3,M)));
fx3=fx33(1:M/2);
figure(1)
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(s1,fx1),title('fx1');
subplot(535),plot(s1,fx2),title('fx2');
subplot(536),plot(s1,fx3),title('fx3');
subplot(537),plot(s1,fh),title('fh');
subplot(538),plot(s1,fh),title('fh');
subplot(539),plot(s1,fh),title('fh');

subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(s1,fy1),title('fy1');
subplot(5,3,14),plot(s1,fy2),title('fy2');
subplot(5,3,15),plot(s1,fy3),title('fy3');

reprsentation graphique :
x1

1
0
-1

50

100

150
fx1

200

250

300

-1

200

400

fh

600

800

1000

100

150
fx2

200

250

300

200

400

y1

600

800

1000

200

400

fh

600

800

1000

50

100

150
fy1

200

250

300

-1

200

400

y2

600

800

1000

200

400

600

800

1000

200

400

200

400

150
fx3

200

250

300

fh

600

800

1000

y3

600

800

1000

0
0

50

100

150
fy2

200

250

300

-1

50

100

20

20
0

100

40

0.5

50

0
0

50

-1
100

0.5

50

-0.5

100

200

100

x3

200

x2

150
fy3

200

250

300

10
0

200

400

600

800

1000

Filtre coupe bande :


Le programme :
%tp5: filtrage RIF eT RII
%Chiheb Chihabeddine
%Guerroui Mohammed
%h(k)=2*fc/fe*sinc(2*fck/fe)
clear all;
close all;
fe=2000;
f0=50;
N=256;
M=512;
s=[-fe/2:fe/M:(fe/2)-1];
s1=[1:fe/M:(fe/2)-1];
fc1=input('tappez la frquence de coupure fc1=');

200

400

600

800

1000

fc2=input('tappez la frquence de coupure fc2=');


% calcule de la frquence impultionelle h(t)
L=129;% la longueure de h(t). le nombre d'echantillons
l=[(-L-1)/2:(L-1)/2];
%hpb1=(2*fc1/fe)*sinc(2*fc1*l/fe);
%hpb2=(2*fc2/fe)*sinc(2*fc2*l/fe);
Wn1=2*fc1/fe;% frquence de couppure ,normalise 1
Wn2=2*fc2/fe
Wn=[Wn1,Wn2];
N1=8;
[B,A] = BUTTER(N1,Wn,'stop');
[H,W] = FREQZ(B,A,N,fe);
fh=abs(H);
%h=hpb2-hpb1;
for k=1:N
x1(k)=cos(2*pi*f0*k/fe);
x2(k)=square(2*pi*f0*k/fe);
x3(k)=sawtooth(2*pi*f0*k/fe);
end
y1=filter(B,A,x1);
y2=filter(B,A,x2);
y3=filter(B,A,x3);
%transforme de fourier des signaux filtrs
fy11=(abs(fft(y1,M)));
fy1=fy11(1:M/2);
fy22=(abs(fft(y2,M)));
fy2=fy22(1:M/2);
fy33=(abs(fft(y3,M)));
fy3=fy33(1:M/2);
%transforme de fourier de la rponse impulsionnelle
%fh=fftshift(abs(fft(h,M)));
%transforme de signaux d'entr
fx11=(abs(fft(x1,M)));
fx1=fx11(1:M/2);
fx22=(abs(fft(x2,M)));
fx2=fx22(1:M/2);
fx33=(abs(fft(x3,M)));
fx3=fx33(1:M/2);
figure(1)
subplot(531),plot(x1),title('x1');
subplot(532),plot(x2),title('x2');
subplot(533),plot(x3),title('x3');
subplot(534),plot(s1,fx1),title('fx1');
subplot(535),plot(s1,fx2),title('fx2');
subplot(536),plot(s1,fx3),title('fx3');
subplot(537),plot(s1,fh),title('fh');
subplot(538),plot(s1,fh),title('fh');
subplot(539),plot(s1,fh),title('fh');
subplot(5,3,10),plot(y1),title('y1');
subplot(5,3,11),plot(y2),title('y2');
subplot(5,3,12),plot(y3),title('y3');
subplot(5,3,13),plot(s1,fy1),title('fy1');
subplot(5,3,14),plot(s1,fy2),title('fy2');
subplot(5,3,15),plot(s1,fy3),title('fy3');

Reprsentation graphique :
x1

1
0
-1

50

100

150
fx1

200

250

300

200

400

fh

600

800

1000

50

100

150
fx2

200

250

300

200

400

y1

600

800

1000

200

400

fh

600

800

1000

50

100

200

150
fy1

200

250

300

-2

200

400

y2

600

800

1000

200

400

600

800

1000

200

400

200

400

50

100

150
fy2

200

250

300

-2

50

100

100

100
0

150
fx3

200

250

300

fh

600

800

1000

y3

600

800

1000

200

100

100

0
0

50

100

1
0

-1

50

100

-2

200

100

-1

x3

200

x2

150
fy3

200

250

300

50
0

200

400

600

800

1000

200

400

600

800

1000