![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428138/image.png)
How to get spatial frequency from FFT?
69 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sohel Rana
le 25 Nov 2020
Modifié(e) : Star Strider
le 3 Juil 2024
Hi,
I have got the first graph based on the following code. How can I get the second graph after performing FFT?
I1=0.7;
I2=0.5;
I3=0.3;
L1=200;
L2=170;
n1=1;
n2=1.444;
lam=(1.52:0.0001:1.56);
Q12=(4*pi*n1*L1)./lam;
Q23=(4*pi*n2*L2)./lam;
Q13=Q12+Q23;
I=I1+I2+I3+2*sqrt(I1*I2).*cos(Q12)+2*sqrt(I2*I3).*cos(Q23)+2*sqrt(I1*I3).*cos(Q13);
plot(lam*1000,I)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428038/image.png)
0 commentaires
Réponse acceptée
Star Strider
le 25 Nov 2020
The Fourier transform neither knows nor cares whether the units of the independent variable are time, space, or anything else. It will do whatever you ask it to do (within limits, of course)
Try this:
I1=0.7;
I2=0.5;
I3=0.3;
L1=200;
L2=170;
n1=1;
n2=1.444;
lam=(1.52:0.0001:1.56);
Q12=(4*pi*n1*L1)./lam;
Q23=(4*pi*n2*L2)./lam;
Q13=Q12+Q23;
I=I1+I2+I3+2*sqrt(I1*I2).*cos(Q12)+2*sqrt(I2*I3).*cos(Q23)+2*sqrt(I1*I3).*cos(Q13);
figure
plot(lam*1000,I)
L = numel(lam);
Ts = mean(diff(lam));
Fs = 1/Ts;
Fn = Fs/2;
FTI = fft(I)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn * 1E-3;
Iv = 1:numel (Fv);
[pks,locs] = findpeaks(abs(FTI(Iv)));
figure
plot(Fv, abs(FTI(Iv)))
xlim([0 0.5])
xlabel('Spatial Frequency (nm^{-1})')
ylabel('Amplitude')
text(Fv(locs), abs(FTI(locs)), sprintfc('Peak %d',(1:numel(locs))), 'HorizontalAlignment','center', 'VerticalAlignment','bottom')
producing:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/428138/image.png)
.
11 commentaires
Chueng
le 3 Juil 2024
hello,can you explain how wavelength is converted to spatial frequency during the FFT processing? Do you have any relevant formulas?
Star Strider
le 3 Juil 2024
Modifié(e) : Star Strider
le 3 Juil 2024
The Fourier transform converts time, distance, or other variables to frequency units of cycles-per-original uint. So for time domain signals with the sampling frequency in seconds, the resulting frequency uints are cycles-per-second, or Hertz (Hz). Here, with the original units being nanometres, the resulting frequency uints are in cycles-per-nanometre, or more simply,
or
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1726891/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1726896/image.png)
EDIT — (3 Jul 2024 at 14:25)
In terms of your other question (How to use fft to analyse the refelction specturm? that I just now saw), simply replace ‘cycles’ with ‘wavenumber’ since that is how you choose to express it, instead labelling it
.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1726901/image.png)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Digital Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!