How do I find the value closest to my desired value in a vector

1 次查看(过去 30 天)
L=10;
n=1.45;
c=2.9979e8;
dt=6e-12; %time increment
Omega=1.020663297455751e+11;
GAMMAb=3.590391604102621e+08;
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);
FA = (-Nt/2:Nt/2-1)/Nt*fs %frequency axis
FA = 1x161224
1.0e+10 * -8.3333 -8.3332 -8.3331 -8.3330 -8.3329 -8.3328 -8.3327 -8.3326 -8.3325 -8.3324 -8.3323 -8.3322 -8.3321 -8.3320 -8.3319 -8.3318 -8.3317 -8.3316 -8.3315 -8.3314 -8.3313 -8.3312 -8.3311 -8.3310 -8.3309 -8.3307 -8.3306 -8.3305 -8.3304 -8.3303
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
How do I find a value closest to ftreqlims in frequency axis.
freqlims=Omega/2/pi-GAMMAb/2/pi
frqlims = 1.6187e+10

回答(1 个)

Matt J
Matt J 2024-5-6
编辑:Matt J 2024-5-6
interp1(FA,FA, freqlims,'nearest')

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by