フィルターのクリア

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

34 ビュー (過去 30 日間)
Passband  Modulation
Passband Modulation 2012 年 8 月 12 日
コメント済み: Gagan Jain 2021 年 12 月 17 日
i have some polymers characterized by transmission terahertz time domain spectroscopy (THz-TDS).
  1 件のコメント
Gagan Jain
Gagan Jain 2021 年 12 月 17 日
Can you please tell where did you extract that data from? I’m doing a similar project

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

採用された回答

Wayne King
Wayne King 2012 年 8 月 12 日
Import the data into MATLAB using xlsread()
Your data will be a Nx2 matrix in MATLAB with the first column the time data and the second column the data you want to Fourier transform.
So for example:
[X,TXT,RAW] = xlsread('yourfile.xls');
xdft = fft(X(:,2));

その他の回答 (2 件)

Wayne King
Wayne King 2012 年 8 月 12 日
編集済み: Wayne King 2012 年 8 月 12 日
There is a slight variation depending on whether you have an even or odd number of samples in your data.
Even length:
xdft = fft(X(:,2));
% sampling interval -- assuming equal sampling
DT = X(2,1)-X(1,1);
% sampling frequency
Fs = 1/DT;
DF = Fs/size(X,1);
freq = 0:DF:Fs/2;
xdft = xdft(1:length(xdft)/2+1);
plot(freq,abs(xdft))
Odd length
xdft = fft(X(:,2));
% sampling interval -- assuming equal sampling
DT = X(2,1)-X(1,1);
% sampling frequency
Fs = 1/DT;
DF = Fs/size(X,1);
freq = 0:DF:Fs/2;
xdft = xdft(1:round(length(x)/2));
plot(freq,abs(xdft))
  4 件のコメント
Mathias
Mathias 2017 年 2 月 25 日
This doesn't seem to work for me. But why not just use the length of freq?
xdft = xdft(1:length(freq));
Sahaphol Hamanee
Sahaphol Hamanee 2018 年 2 月 14 日
編集済み: Sahaphol Hamanee 2018 年 2 月 14 日
Hi Wayne King, thank you for your guidance. May I ask what DF = Fs/size(X,1); is for? What is the meaning of it? It is the only thing I didn´t understand.
Best Regards

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


Wayne King
Wayne King 2012 年 8 月 13 日
編集済み: Wayne King 2012 年 8 月 13 日
To get the phase, use angle()
phi = angle(xdft);
To export the frequencies and magnitudes back to Excel, place them in a matrix.
Xdftmatrix = [freq' abs(xdft)];
then use xlswrite
  1 件のコメント
Wayne King
Wayne King 2012 年 8 月 13 日
編集済み: Wayne King 2012 年 8 月 13 日
phi = angle(xdft);
plot(freq,phi)
You want to plot the phase as a function of frequency

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by