Spectrum graph from sinusoidal signal in wavelength

4 ビュー (過去 30 日間)
Joel Ruiz
Joel Ruiz 2020 年 9 月 23 日
回答済み: Ameer Hamza 2020 年 9 月 24 日
Hello everybody:
I need to plot in Matlab an intensity modulation from and optical source. First, I need to calculate FFT of the sinusoidal signal of the source but instead of using an x-frequency axis I need to use and x-wavelength axis.
How can I do that?
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 9 月 24 日
But frequency in fft() starts from 0. That will translates to a wavelength of infinity. Which range do you want to use?
Joel Ruiz
Joel Ruiz 2020 年 9 月 24 日
From 700 nm to 1560 nm

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 9 月 24 日
This is a modified version of the example on MATLAB fft() documentation page. For this example, I assume wavelength = 1/f. And I restrict the wavelength in range 0.003 to 1.
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
S = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t);
X = S + 2*randn(size(t));
Y = fft(X);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
lambda = 1./f;
idx = (lambda > 0.003) & (lambda < 0.1);
lambda = lambda(idx);
P1 = P1(idx);
plot(lambda, P1);
xlabel('wavelength');
ylabel('amplitude')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by