TP Traitement Du Signal 05
TP Traitement Du Signal 05
TP Traitement Du Signal 05
But de TP:
%signal temporel
f0=1;t0=1/f0;N=1e3;
t=linspace(-2*t0,2*t0,N);
s_t=sin(2*pi*f0*t);
%Affichage figure
subplot(3,1,1);
plot(t,s_t,'linewidth',2);
grid on;
xlabel('Temps');
ylabel('Amplitude');
% FFT
ts=t(2)-t(1);fs=1/ts;
N_fft=2^14;
s_fft=fft(s_t,N_fft);
s_fftsh=fftshift(s_fft);
f=linspace(-fs/2,fs/2,N_fft);
subplot(3,1,2);
plot(f,real((s_fftsh)),'linewidth',2);
grid on;hold on;
plot(f,imag((s_fftsh)),'r','linewidth',2);
legend('réel','imaginaire');
xlabel('Frequence');ylabel('Amplitude');
subplot(3,1,3);
plot(f,abs((s_fftsh)),'g','linewidth',2);
grid on;hold on;
xlabel('Frequence');ylabel('Amplitude');
title('Module');
Tracer la FFT d’un signal carré :
f0=1;t0=1/f0;N=1e3;
t=linspace(-2*t0,2*t0,N);
s_t=square(2*pi*f0*t);
%Affichage figure
subplot(3,1,1);
plot(t,s_t,'linewidth',2);
grid on;
xlabel('Temps');
ylabel('Amplitude');
% FFT
ts=t(2)-t(1);fs=1/ts;
N_fft=2^14;
s_fft=fft(s_t,N_fft);
s_fftsh=fftshift(s_fft);
f=linspace(-fs/2,fs/2,N_fft);
subplot(3,1,2);
plot(f,real((s_fftsh)),'linewidth',2);
grid on;hold on;
plot(f,imag((s_fftsh)),'r','linewidth',2);
legend('réel','imaginaire');
xlabel('Frequence');ylabel('Amplitude');
subplot(3,1,3);
plot(f,abs((s_fftsh)),'g','linewidth',2);
grid on;hold on;
xlabel('Frequence');ylabel('Amplitude');
title('Module');
%%% ifft
figure(2);
xt_ifft = ifft(ifftshift((s_fftsh)));
t1=linspace(-0.5*t0,0.5*t0,length(xt_ifft));
length(xt_ifft)
plot(t1, xt_ifft ,'b','LineWidth',2), grid ; title(" x(t)
from ifft ");