Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. clf
  2. theta = 0.2;
  3. T = 1;
  4. N = 8; % les termes de la série de Fourier iront de -N à N
  5. tMin = -3*T;
  6. tMax = 5*T;
  7. nSteps = 2^14+1; % nb d’échantillons
  8. t = linspace(tMin,tMax,nSteps); % 16385 échantillons répartis linéairement
  9. x = sq(theta,T,t);
  10.  
  11. figure(1)
  12. hold on, grid on
  13. axis([tMin tMax -1 2]) % fixe les limites du graphique
  14. plot(t,x)
  15.  
  16. f = -N/T:1/T:N/T;
  17. spectrum = sin(f*T*theta)./(f*T);
  18. figure(2)
  19. hold on, grid on
  20. stem(f,spectrum,"r") % stem est comme plot, mais utilise des raies
  21. fFast = -N/T:1/(4*T):N/T;
  22. envelope = theta * sinc(fFast*T*theta);
  23. plot(fFast,envelope,"k")
  24.  
  25. xFourier = zeros(size(t)); % tableau de zéros ayant la même taille que t
  26. for n = -N:N
  27. cn = spectrum(N+1-n); % la liste spectrum contient les coef de Fourier
  28. xFourier = xFourier + cn * exp(2*1i*pi*n/T*t);
  29. end
  30.  
  31. figure(1)
  32. hold on
  33. plot(t,real(xFourier),"r")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement