Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.46 KB | None | 0 0
  1. %TBeach
  2. clc
  3. clear all
  4.  
  5. %xt=3*cos(2*pi*16*t)*sin(2*pi*2*t)
  6.  
  7. fs=100; %samples per second
  8. dt=1/fs; %seconds per sample
  9. Stoptime=1; %seconds
  10. t=(0:dt:Stoptime-dt)'; %domain
  11. N=size(t,1); %array size
  12. xt=3*cos(2*pi*16*t).*sin(2*pi*2*t); %signal definition
  13. fft_xt=fftshift(fft(xt)); %fourier transform of signal
  14. dF=fs/N; %
  15. f=-fs/2:dF:fs/2-dF; %frequency domain
  16. figure;
  17. stem(f,abs(fft_xt)/N);
  18. xlabel('Frequency (Hz)');
  19. ylabel('Magnitude of X(f)');
  20. title('Spectrum of x(t)');
  21. grid;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement