How to plot the spectrum of a high frequency sine wave of above 1GHz
9 views (last 30 days)
Show older comments
Praveen kumar
on 13 Feb 2014
Commented: Praveen kumar
on 17 Feb 2014
Please help me with the matlab code
0 Comments
Accepted Answer
Wayne King
on 13 Feb 2014
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 x
deltaf = Fs/length(x);
freqvec = 0:deltaf:Fs/2;
plot(freqvec,abs(xdft))
Note that latter is not scaled.
3 Comments
More Answers (0)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!