How to use FFT in matlab using imported data in time domain excel file

9 ビュー (過去 30 日間)
Javis Chiu
Javis Chiu 2017 年 3 月 6 日
コメント済み: Star Strider 2024 年 6 月 9 日
I have used a multimeter to measure my phototransistor and I got one excel file with time versus Magnitude. But I got some noise, so I want to use Matlab to do FFT from time domain to frequency domain(frequency versus magnitude) called Photorespone. I attach my file as below. I wanna make this kind of figure, freq versus amplitude.
  3 件のコメント
Linda Yakoubi
Linda Yakoubi 2017 年 5 月 10 日
I have a similar task. I already imported the data from excel in Matlab but I don't know what to do next and how to use the function "fft()". Any ideas ?
Adam
Adam 2017 年 5 月 10 日
doc fft
is the best place to start!

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

採用された回答

Star Strider
Star Strider 2017 年 3 月 8 日
Use the examples in the documentation on fft (link) to calculate the Fourier transform.
Example Code For Your Signal
[d,s] = xlsread('1.5V.csv');
t = d(:,1)*1E-3; % Convert To ‘seconds’ From ‘milliseconds’
v = d(:,2); % Voltage (?)
L = length(t);
Ts = mean(diff(t)); % Sampling Interval (sec)
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
vc = v - mean(v); % Subtract Mean (‘0 Hz’) Component
FTv = fft(vc)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector (Hz)
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(FTv(Iv))*2)
grid
xlabel('Frequency (Hz)')
ylabel('Amplitude (V?)')
I did not post the plot, since my code will plot the Fourier transform of your data.
  12 件のコメント
Jonathan James-Gunn
Jonathan James-Gunn 2024 年 6 月 9 日
@Star Strider Thank you! I really appreciate the help.
Star Strider
Star Strider 2024 年 6 月 9 日
My pleasure!
A Vote would be appreciated!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by