Advertisement
Guest User

Fourie sequence

a guest
Mar 30th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. %%Time specifications:
  2. Fs = 120; % samples per second
  3. dt = 1/Fs; % seconds per sample
  4. StopTime = 1; % seconds
  5. t = (0:dt:StopTime-dt)';
  6. N = size(t,1);
  7. %%Sine wave:
  8. Fc1 = 40;
  9. Fc2 = 120; % hertz
  10. x = 2*cos(2*pi*Fc1*t) + sin(2*pi*Fc2*t) ;
  11. %%Fourier Transform:
  12. X = fftshift(fft(x));
  13. %%Frequency specifications:
  14. dF = Fs/N; % hertz
  15. f = -Fs/2:dF:Fs/2-dF; % hertz
  16. %%Plot the spectrum:
  17. figure;
  18. plot(f,abs(X)/N);
  19. xlabel('Frequency (in hertz)');
  20. title('Magnitude Response');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement