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 Ansicht (letzte 30 Tage)
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));
Warning: Imaginary parts of complex X and/or Y arguments ignored.
%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.

Antworten (1)

Paul
Paul am 5 Mai 2024
The code has
fs = 80*fmax;
but the TA vector is space by dt, so fs should be
fs = 1/dt;

Kategorien

Mehr zu Fourier Analysis and Filtering finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by