efrei/theorie-signal/exercices/tp1/x2_frequentiel.m

23 lines
411 B
Mathematica
Raw Normal View History

% x2 freqentiel
2022-01-06 23:59:42 +01:00
2022-01-07 00:05:39 +01:00
f0 = 2;
2022-01-06 23:59:42 +01:00
N = 20;
fe = 50*N*f0;
Tps = [0 :1/fe: 1-1/fe];
for r = [1/2,1/3,1/4]
a0 = r;
x = a0 * ones(1,length(Tps));
for n = 1:N
an = 2*sin(n*pi*r)/(n*pi);
x = x + a0 + an*cos(n*2*pi*f0*Tps);
end
X=fft(x);
Frq = [0 : fe/length(x) : fe - fe/length(x)];
figure
plot(Frq,abs(X));
xlabel = "f";
ylabel = "Sx2(f)";
Title = "DSP de x2";
end