How to plot the spectrum of a high frequency sine wave of above 1GHz

9 次查看(过去 30 天)
Please help me with the matlab code

采纳的回答

Wayne King
Wayne King 2014-2-13
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 个评论
Praveen kumar
Praveen kumar 2014-2-14
After performing autocorrelation to sinusoidal signal, i'm not getting the spectrum at high frequencies.
Praveen kumar
Praveen kumar 2014-2-17
I have written the following code inorder to determine the Spectrum of autocorrelated noisy sine signal. But, I'm not able to get the spectrum for higher frequencies above 1MHz. Please inform where i have to change the code... close all; clear all; clc; %% Time specifications: Fs = 1e4; % samples per second dt = 1/Fs; % seconds per sample StopTime = 1; % seconds t = (0:dt:StopTime-dt)'; N = size(t,1);
%%Sine wave:
Fc = 1e3; % hertz
x = sin(2*pi*Fc*t);
noisy_x = x + 0.5*randn(size(x));
y = xcorr(noisy_x,5e3,'biased');
display(size(y));
subplot(2,1,1);
plot(t,x);
title('Sine signal');
subplot(2,1,2);
plot(t,noisy_x);
title('Noisy signal');
%%Fourier Transform:
X = fftshift(fft(y));
%%Frequency specifications:
dF = Fs/N; % hertz
f = -Fs/2:dF:Fs/2; % hertz
display(size(f));
display(size(X));
%%Plot the spectrum:
figure;
plot(f,abs(X)/N);
xlabel('Frequency (in hertz)');
title('Autocorrelation spectrum');

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by