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

8 ビュー (過去 30 日間)
Praveen kumar
Praveen kumar 2014 年 2 月 13 日
コメント済み: Praveen kumar 2014 年 2 月 17 日
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 Center および File ExchangeSpectral Measurements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by