I can't place the fft curve at the signal frequency exactly. There's been a slight deviation of the fft peak at that frequency
조회 수: 1 (최근 30일)
이전 댓글 표시
clear all
close all
clc
L=10;
n=1.45;
c=2.9979e8;
dt=6e-12;
T=10*2*L*n/c;
fmax = 1e9;
fs=80*fmax;
TA=-T/2:dt:T/2;
%t = (-T/2/dt:1:T/2/dt)*dt;
Nt=round(T/dt);
vsine = 1;
phi = vsine*sin(2*pi*fmax*TA);
EL1t=1.274e7*exp(1i*phi);
plot(TA,(EL1t));
%FA = ((0:Nt-1)-floor(Nt/2))/Nt*fs;
FA = (-Nt/2:Nt/2-1)/Nt*fs*2;
FP=fft(phi);
%fs=1/dt/Nt;
figure;
Z=plot(FA,fftshift(abs(fft(EL1t/Nt))));
xline(1e9);
xlim([-2e9 2e9]);
As per the logic , each peak should have been at the multiples of 1GHz like the first peak should have been at 1GHz and the next at 2GHz and so on.
But evidently there has been a slight devition.
댓글 수: 0
답변 (1개)
Paul
2024년 5월 5일
The code has
fs = 80*fmax;
but the TA vector is space by dt, so fs should be
fs = 1/dt;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!