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 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Paul
on 5 May 2024
The code has
fs = 80*fmax;
but the TA vector is space by dt, so fs should be
fs = 1/dt;
0 Comments
See Also
Categories
Find more on Fourier Analysis and Filtering 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!