Getting different outputs from indexing and graphically.How do I verify this indexing value?..
Show older comments
clear all
close all
clc
L=10;
n=1.45;
Omega=1.020663297455751e+11;
GAMMAb=3.590391604102621e+08;
c=2.9979e8;
dt=6e-12; %time increment
T=10*2*L*n/c; %total time
fmax = 1e9; %maximun frequency
%fs=80*fmax;
TA=-T/2:dt:T/2; %time axis for the signal
fs=1/dt; %sampling frequency
%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); %signal
plot(TA,(EL1t));
%FA = ((0:Nt-1)-floor(Nt/2))/Nt*fs;
FA = (-Nt/2:Nt/2-1)/Nt*fs; %frequency axis
FP=fft(phi); %fft of the signal
%fs=1/dt/Nt;
figure;
Z=plot(FA,fftshift(abs(fft(EL1t/Nt)))); %fft plot with frequency axis
xlim([(Omega/2/pi-GAMMAb/2/pi/2) (Omega/2/pi+GAMMAb/2/pi/2)])
freqlim1=dsearchn(FA',(Omega/2/pi-GAMMAb/2/pi/2))
freqlim2=dsearchn(FA',(Omega/2/pi+GAMMAb/2/pi/2))
FA1=freqlim1:freqlim2;
freqlim=dsearchn(FA',Omega/2/pi)
Y1=fftshift(abs(fft(EL1t(freqlim)/Nt))) %value of the signl at Omega
I have been trying the index of the signal corresponding to frequency at Omega.Graphically it is around 197 and when i substitute the index number in the fft expression , it is showing around 79.
Is this the case of indexing gone wrong??...
Accepted Answer
More Answers (0)
Categories
Find more on Transforms 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!

