MATLAB: How to plot the spectrum of a high frequency sine wave of above 1GHz fft Please help me with the matlab code Best Answer Do you have the Signal Processing Toolbox:Fs = 4e9;t = 0:1/Fs:0.001-(1/Fs);x = cos(2*pi*1.5e9*t);[Pxx,F] = periodogram(x,[],length(x),Fs,'power');plot(F,Pxx)If you do not, you can use fft()xdft = fft(x);xdft = xdft(1:length(x)/2+1); % works for even length xdeltaf = Fs/length(x);freqvec = 0:deltaf:Fs/2;plot(freqvec,abs(xdft))Note that latter is not scaled. Related SolutionsMATLAB: FFT of vibration data Fs = 800; % sampling rate of 1000 Hz t = 0:1/Fs:1-1/Fs; x = ad2; xdft = fft(x); xdft = xdft(1:length(x)/2+1); DF = Fs/length(x); % frequency increment freqvec = 0:DF:Fs/2; plot(freqvec,abs(xdft))I hope this can work Related Question
Best Answer