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

조회 수: 8 (최근 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