Sei sulla pagina 1di 12

TP3 Souhail Charbti Oussema BenAbbes

Le programme principal
clear all;
close all;
clc;
f0=5;
t0=0.001;
t=[-2:t0:2];
x=sinc(f0*t);
%
figure(1)
plot(t,x);
xlabel('le temps (s)');
ylabel('amplitude');
title('le signal temporel');

%%
fe1=5;
fe2=10;
fe3=30;
te1=1/fe1;
te2=1/fe2;
te3=1/fe3;
t1=[-2:te1:2];
t2=[-2:te2:2];
t3=[-2:te3:2];
x1=sinc(f0*t1);
x2=sinc(f0*t2);
x3=sinc(f0*t3);
figure(2)
TP3 Souhail Charbti Oussema BenAbbes

subplot(311); plot(t1,x1); title('x(t) pour fe = 5 Hz');


subplot(312); plot(t2,x2); title('x(t) pour fe = 10 Hz');
subplot(313); plot(t3,x3); title('x(t) pourfe = 30 Hz');

%%
Te1=1/5;
deltaT11=Te1;
deltaT12=Te1/5;
tm=-2:Te1:2;
Xech_moy11=moyenneur(x,t,Te1,deltaT11);
Xech_moy12=moyenneur(x,t,Te1,deltaT12);
figure(3)
subplot(311); plot(t,x); title('signal x(t)');
subplot(312); plot(tm,Xech_moy11); title('moyenneur pour fe = 5 Hz');
subplot(313); plot(tm,Xech_moy12);
TP3 Souhail Charbti Oussema BenAbbes

%%
Te2=1/10;
deltaT21=Te2;
deltaT22=Te2/5;
tm=-2:Te2:2;
Xech_moy21=moyenneur(x,t,Te2,deltaT21);
Xech_moy22=moyenneur(x,t,Te2,deltaT22);
figure(4)
subplot(311); plot(t,x); title('signal x(t)');
subplot(312); plot(tm,Xech_moy21); title('moyenneur pour fe = 10 Hz');
subplot(313); plot(tm,Xech_moy22);
TP3 Souhail Charbti Oussema BenAbbes

%%
Te3=1/30;
deltaT31=Te3;
deltaT32=Te3/5;
tm=-2:Te3:2;
Xech_moy31=moyenneur(x,t,Te3,deltaT31);
Xech_moy32=moyenneur(x,t,Te3,deltaT32);
figure(5)
subplot(311); plot(t,x); title('signal x(t)');
subplot(312); plot(tm,Xech_moy31); title('moyenneur pour fe = 30 Hz');
subplot(313); plot(tm,Xech_moy32);
TP3 Souhail Charbti Oussema BenAbbes

%%

Xr1=BOZ(Xech_moy12,t,Te1);
figure(6)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xr1); title('bloqueur pour fe= 5 Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%

Xr2=BOZ(Xech_moy22,t,Te2);
figure(7)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xr2); title('bloqueur pour fe= 10 Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%

Xr3=BOZ(Xech_moy32,t,Te3);
figure(8)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xr3); title('bloqueur pour fe= 30Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%
Xl1=interp_lin(Xech_moy12,t,Te1);
figure(9)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xl1); title('interpolateur lineaire pour fe= 5 Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%
Xl2=interp_lin(Xech_moy22,t,Te2);
figure(10)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xl2); title('interpolateur lineaire pour fe= 10 Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%
Xl3=interp_lin(Xech_moy32,t,Te3);
figure(11)
subplot(211); plot(t,x); title('signalx(t)');
subplot(212); plot(t,Xl3); title('interpolateur lineaire pour fe= 30 Hz');
TP3 Souhail Charbti Oussema BenAbbes

%%On remarque la fonctionnalité des divers fonctions bloqueur


moyenneur et interpolateur lineaire pour une basse fréquence
d’échantillonnage comme fe=5Hz.

Les fonctions
function moy=moyenneur(x,t,te,deltaT);
tech=-2:te:2;
for n=1:length(tech)
nb_points=find((t>=tech(n))&(t<tech(n)+te));
Xech_reel(n)=mean(x(nb_points));
end
moy=Xech_reel;
end

function Xboz=BOZ(xechant_reel,t,Te);
Xbloqueur=zeros(size(t));
tech=-2:Te:2;
for m=1:length(tech)-1
nb_points=find((t>=tech(m))&(t<tech(m+1)));
Xbloqueur(nb_points)=xechant_reel(m);
end
Xboz=Xbloqueur;
end
TP3 Souhail Charbti Oussema BenAbbes

function Xinterp=interp_lin(xechant_reel,t,Te);
tech=-2:Te:2;
Xinterpole_lin=zeros(size(t));
for p=1:length(tech)-1
nb_point=find((t>=tech(p))&(t<tech(p+1)));

for valeur=1:length(nb_point)
Xinterpole_lin(nb_point(valeur))=(((xechant_reel(p+1)-
xechant_reel(p))./length(nb_point))*(valeur-1))+xechant_reel(p);
end
end
Xinterp=Xinterpole_lin;
end

Potrebbero piacerti anche