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
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.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. 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. fft, plot MATLAB Answers — New Questions