You are on page 1of 6

PASSE BANDE :

fe=1000;
fc=190;
n=9;
fc1=100
fc2=200
fcn1=fc1/(fe/2)
fcn2=fc2/(fe/2)
te=1/fe
h=fir1(n-1,[fcn1 fcn2],rectwin(n))
%fff=[0 fcn fcn 1]
%a=[1 1 0 0]
%h=fir2(n-1 , fff, a , rectwin(n))
[y,n]=impz(h,1,n)
stem(n,y)
[H,f]=freqz(h,1,1024,fe)
g=20*log10(abs(H))
plot(f,g),axis([0 fe/2 -100 0]),grid
t=0:te:1023*te;
ff=(0:1023)*(fe/1024)
x=sin(2*pi*50*t)+sin(2*pi*150*t)+sin(2*pi*300*t)
fx=fft(x,1024)
xf=filter(h,1,x)
fxf=fft(xf,1024)
subplot(4,1,1),plot(t,x),axis([0.1 0.2 -2 2])
subplot(4,1,2),plot(ff,abs(fx)),axis([0 fe/2 0 500])
subplot(4,1,3),plot(t,xf),grid,axis([0.1 0.2 -2 2])
subplot(4,1,4),plot(ff,abs(fxf)),grid,axis([0 fe/2 0 500])
COUPE BANDE :
fe=1000;
fc=190;
n=65;
fc1=100
fc2=200
fcn1=fc1/(fe/2)
fcn2=fc2/(fe/2)
te=1/fe
h=fir1(n-1,[fcn1 fcn2],'stop',hamming(n))
%fff=[0 fcn fcn 1]
%a=[1 1 0 0]
%h=fir2(n-1 , fff, a , rectwin(n))
[y,n]=impz(h,1,n)
stem(n,y)
[H,f]=freqz(h,1,1024,fe)
g=20*log10(abs(H))
plot(f,g),axis([0 fe/2 -100 0]),grid
t=0:te:1023*te;
ff=(0:1023)*(fe/1024)
x=sin(2*pi*50*t)+sin(2*pi*150*t)+sin(2*pi*300*t)
fx=fft(x,1024)
SYNTHESE DU FILTRE RECURSIFS :
FILTRE PASSE BAS

ORDRE 2
fc=100;fe=1000;fcn=fc/(fe/2)
n=input('ordre du filtre=')
[z,p,k]=cheb1ap(n,2)
[num,den]=zp2tf(z,p,k)
fa=(fe/pi)*tan(pi*(fc/fe));
[numd,dend]=lp2lp(num,den,2*pi*fa)
[numz1,denz1]=bilinear(numd,dend,fe)
[H,f]=freqz(numz1,denz1,1024,fe)
g=20*log10(abs(H))
plot(f,g),axis([0 fe/2 -10 2]),grid

fc=100; fe=1000; fcn= fc/(fe/2);


n=input("ordre de filtre")
[numz,denz]=cheby1(n,2,fcn)
[H,f]=freqz(numz,denz,1024,fe)
g=20*log10(abs(H))
plot(f,g),axis([0 fe/2 -10 2]),grid
ORDRE 2
FILTRE PASSE BANDE

%filtre passe bande


fc1=100; fe=1000; fcn1= fc/(fe/2);te=1/fe;
fc2=300; fcn2= fc2/(fe/2)
n=input("ordre de filtre")
[numz,denz]=butter(n,[fcn1,fcn2])
[H,f]=freqz(numz,denz,1024,fe)
g=20*log10(abs(H))
plot(f,g),axis([0 fe/2 -10 0]),grid

t=0:te:1023*te;
ff=(0:1023)*(fe/1024)
x=sin(2*pi*50*t)+sin(2*pi*150*t)+sin(2*pi*300*t)
fx=fft(x,1024)
xf=filter(numz,denz,x)
fxf=fft(xf,1024)
subplot(4,1,1),plot(t,x),axis([0.1 0.2 -2 2])
subplot(4,1,2),plot(ff,abs(fx)),axis([0 fe/2 0 500])
subplot(4,1,3),plot(t,xf),grid,axis([0.1 0.2 -2 2])
subplot(4,1,4),plot(ff,abs(fxf)),grid,axis([0 fe/2 0 500])
FILTRE REJECTEUR DE BANDE
fc1=100;fc2=300; fe=1000; fcn1= fc1/(fe/2);te=1/fe;fcn2= fc2/(fe/2);

n=input('ordre de filtre')

[numz,denz]=butter(n,[fcn1 fcn2],'stop')

[H,f]=freqz(numz,denz,1024,fe)

g=20*log10(abs(H))

plot(f,g),axis([0 fe/2 -10 0]),grid

t=0:te:1023*te

ff=(0:1023)*(fe/1024)

x=sin(2*pi*50*t)+sin(2*pi*150*t)+sin(2*pi*300*t)

fx=fft(x,1024)

xf=filter(numz,denz,x)

fxf=fft(xf,1024)

subplot(4,1,1),plot(t,x),axis([0.1 0.2 -2 2])

subplot(4,1,2),plot(ff,abs(fx)),axis([0 fe/2 0 500])

subplot(4,1,3),plot(t,xf),grid,axis([0.1 0.2 -2 2])

subplot(4,1,4),plot(ff,abs(fxf)),grid,axis([0 fe/2 0 500])

You might also like