61 lines
776 B
Matlab
Executable file
61 lines
776 B
Matlab
Executable file
clear;
|
|
|
|
% exercice 1
|
|
|
|
f1 = 1000;
|
|
f2 = 3000;
|
|
N = 100;
|
|
|
|
Fe = 10000;
|
|
Te = 1/Fe;
|
|
|
|
T = [0:Te:(N-1)*Te];
|
|
|
|
Y1 = cos(2*pi*f1 * T);
|
|
Y2 = cos(2*pi*f2 * T);
|
|
|
|
Ys = Y1 + Y2;
|
|
% plot(T, Ys);
|
|
% hold;
|
|
|
|
% fft discrète
|
|
% semilogy([0:N-1]/N*Fe, abs(fft(Ys, N)));
|
|
|
|
|
|
|
|
% exercice 2
|
|
|
|
fc_tild = 1000/Fe;
|
|
A = 1;
|
|
|
|
ordre = 10;
|
|
B = 2*fc_tild * sinc(2*fc_tild * [-ordre/2:1:ordre/2]);
|
|
%plot(B);
|
|
%hold;
|
|
|
|
ordre = 60;
|
|
B = 2*fc_tild * sinc(2*fc_tild * [-ordre/2:1:ordre/2]);
|
|
%plot(B);
|
|
|
|
|
|
|
|
% exercice 3
|
|
|
|
fc_tild = 1000/Fe;
|
|
A = 1;
|
|
|
|
ordre = 10;
|
|
B = 2*fc_tild*sinc(2*fc_tild * [-ordre/2:1:ordre/2]);
|
|
Yf = filter( B, A, Ys);
|
|
semilogy([0:N-1]/N*Fe, abs(fft(Yf, N)));
|
|
|
|
hold;
|
|
|
|
ordre = 60;
|
|
B = 2*fc_tild*sinc(2*fc_tild * [-ordre/2:1:ordre/2]);
|
|
Yf = filter( B, A, Ys);
|
|
semilogy([0:N-1]/N*Fe, abs(fft(Ys, N)));
|
|
|
|
|
|
|
|
legend; |