Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clf
- theta = 0.2;
- T = 1;
- N = 8; % les termes de la série de Fourier iront de -N à N
- tMin = -3*T;
- tMax = 5*T;
- nSteps = 2^14+1; % nb d’échantillons
- t = linspace(tMin,tMax,nSteps); % 16385 échantillons répartis linéairement
- x = sq(theta,T,t);
- figure(1)
- hold on, grid on
- axis([tMin tMax -1 2]) % fixe les limites du graphique
- plot(t,x)
- f = -N/T:1/T:N/T;
- spectrum = sin(f*T*theta)./(f*T);
- figure(2)
- hold on, grid on
- stem(f,spectrum,"r") % stem est comme plot, mais utilise des raies
- fFast = -N/T:1/(4*T):N/T;
- envelope = theta * sinc(fFast*T*theta);
- plot(fFast,envelope,"k")
- xFourier = zeros(size(t)); % tableau de zéros ayant la même taille que t
- for n = -N:N
- cn = spectrum(N+1-n); % la liste spectrum contient les coef de Fourier
- xFourier = xFourier + cn * exp(2*1i*pi*n/T*t);
- end
- figure(1)
- hold on
- plot(t,real(xFourier),"r")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement