1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| T = 5;
Fe = 100;
Te = 1/Fe;
Fc = 2/T;
F = 0.5;
figure
nbPlotV = 7;
nbPlotH = 1;
t = -20:Te:20;
sinus = sin(2*pi*F*t);
subplot (nbPlotV,nbPlotH,1)
plot(t,sinus)
axis([-5 5 -1 1]);
title('Sinus');
xlabel('Temps');
ylabel('Amplitude');
f = linspace(-Fe/2, Fe/2, length(t));
TFDSinus = fftshift(fft(sinus)*Te);
subplot (nbPlotV,nbPlotH,2)
plot(f,abs(TFDSinus));
axis([-2 2 -0.05 20]);
title('TF(sinus)');
xlabel('Fréquence');
ylabel('Amplitude');
t = -20:Te:20;
porte = (((-T/2)<=t)&(t<=(T/2)));
subplot (nbPlotV,nbPlotH,3)
plot(t,porte)
axis([-5 5 -0.05 1.05]);
title('Porte');
xlabel('Temps');
ylabel('Amplitude');
TFDPorte = fftshift(fft(porte)*Te);
subplot (nbPlotV,nbPlotH,4)
plot(f,abs(TFDPorte));
axis([-2 2 -0.05 5]);
title('TF(porte)');
xlabel('Fréquence');
ylabel('Amplitude');
convolutionResult = conv(double(porte), sinus);
subplot (nbPlotV,nbPlotH,5)
tt=0:length(convolutionResult)-1;
plot(tt,convolutionResult);
title('Convolution -> sinus * porte');
xlabel('Temps');
ylabel('Amplitude');
ff = linspace(-Fe/2, Fe/2, length(tt));
TFDresConv = fftshift(fft(convolutionResult)*Te);
subplot (nbPlotV,nbPlotH,6)
max1=max(TFDresConv);
TFDresConv=TFDresConv/max1;
plot(ff,abs(TFDresConv));
axis([-2 2 0 1]);
title('TF(sinus * porte)');
xlabel('Fréquence');
ylabel('Amplitude');
dotRes = abs(TFDSinus) .* abs(TFDPorte);
subplot (nbPlotV,nbPlotH,7)
max2=max(dotRes);
dotRes=dotRes/max2;
plot(f,abs(dotRes));
axis([-2 2 0 1]);
title('Produit -> TFD(sinus) * TFD(PORTE)');
xlabel('Fréquence');
ylabel('Amplitude'); |
Partager