Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function myFFT = ass5e2()
  2. %% n = 500
  3. n = 500;
  4. t = linspace(0,1000,n);
  5. x = sin(80*pi*t) + 0.5*sin(180*pi*t);
  6. % x = [1 0 -1 0];
  7. w = exp(-2*i*pi/n);
  8. wmat = ones(n,n);
  9.  
  10. for a = (1:n)
  11. for b = (1:n)
  12. wmat(a,b) = w^(mod((a-1)*(b-1),n));
  13. end
  14. end
  15. wmat = (1/sqrt(n)) * wmat;
  16. x = x';
  17. z = wmat*x;
  18. hold on
  19. xlabel('Frequencies (Hz)');
  20. ylabel('Amplitude');
  21. plot([0:2:1000-2],abs(z))
  22. z(2:11)
  23. z(n-9:n)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement