55 lines
855 B
Mathematica
55 lines
855 B
Mathematica
|
% x1
|
||
|
A = ;
|
||
|
f0 = ;
|
||
|
N = ; % nombre delements de la DSF
|
||
|
fe = 50*N*f0;
|
||
|
Tps = [0 :1/fe: 1-1/fe];
|
||
|
a0 = 1/2;
|
||
|
an = (2/(n*n*pi*pi))(-cos(n*pi) + 1)
|
||
|
x = a0 * ones(1,length(Tps)); % a0 est a remplacer par la valeur calculee
|
||
|
for n = 1:N
|
||
|
x = x + a0 + an*cos(n*2*pi*f0*Tps);
|
||
|
end
|
||
|
figure
|
||
|
plot(Tps,x);
|
||
|
xlabel = "t"
|
||
|
ylabel = "x(t)"
|
||
|
Title = ""
|
||
|
|
||
|
% freqentielle
|
||
|
X=fft(x);
|
||
|
Frq = [];
|
||
|
figure
|
||
|
plot(Frq,abs(X));
|
||
|
xlabel = "";
|
||
|
ylabel = "";
|
||
|
Title = "";
|
||
|
|
||
|
% x2
|
||
|
A = ;
|
||
|
r = ;
|
||
|
f0 = ;
|
||
|
N = ; % nombre delements de la DSF
|
||
|
fe = 50*N*f0;
|
||
|
Tps = [0 :1/fe: 1-1/fe];
|
||
|
a0 = r;
|
||
|
an = 2* (sin(n*pi*r))/(n*pi);
|
||
|
x = a0 * ones(1,length(Tps)); % a0 est a remplacer par la valeur calculee
|
||
|
for n = 1:N
|
||
|
x = x + a0 + an*cos(n*2*pi*f0*Tps)+;
|
||
|
end
|
||
|
figure
|
||
|
plot(Tps,x);
|
||
|
xlabel = "t"
|
||
|
ylabel = "x(t)"
|
||
|
Title = ""
|
||
|
|
||
|
% freqentielle
|
||
|
X=fft(x);
|
||
|
Frq = [];
|
||
|
figure
|
||
|
plot(Frq,abs(X));
|
||
|
xlabel = "";
|
||
|
ylabel = "";
|
||
|
Title = "";
|