matlab beginner: use FFT in matlab and get phase plot

6 ビュー (過去 30 日間)
Passband  Modulation
Passband Modulation 2012 年 8 月 15 日
回答済み: jingming cao 2017 年 4 月 6 日
Sorry for asking this question again, but i have to (so urgent)
i have some polymers characterized by transmission terahertz time domain spectroscopy (THz-TDS).
ive now the time domain data in Excel, with column A being (Delay ps), column B (Reference Amplitude nA), column C (Sample Amplitube nA) as follows.
i would like to have "FFT phase of column C" minus "FFT phase of column B", and then plot the phase (after deduction) as a function of frequency.
the following are the codes some nice people suggested.
[X,TXT,RAW] = xlsread('C:\Users\in Me u trust\Desktop\test\PP_1.CSV');
xdft = fft(X(:,2));
Nt = size(X,1); % Number of time samples
DT = X(2,1)-X(1,1);
Fs = 1/DT % sample frequency (= 1/dt)
df = Fs/Nt; % frequency increment
Nyq = Fs/2; % Nyquist frequency
if mod(Nt,2) == 0 % Nt is even
freq = ifftshift(-Nyq : df : Nyq-df);
else % Nt is odd
freq = ifftshift([sort(-1*(df:df:Nyq)) (0:df:Nyq)]);
end
xdft = xdft(1:length(xdft)/2+1);
phi = angle(xdft);
plot(freq,angle(fft(X(:,3)))-angle(fft(X(:,2))))
Anyway, these codes are collected from different people, and i as a beginner of Matlab just simply put them together so that they might not be coherent or what?? no idea and the question raised as follows.
so can anyone so nice to help perfect the code? thz in advance

回答 (2 件)

Ilham Hardy
Ilham Hardy 2012 年 8 月 15 日
I just skimmed over your code. I think the problem lies in
plot(freq,angle(fft(X(:,3)))-angle(fft(X(:,2))))
it should looks
substr = angle(fft(x(:,3)))-angle(fft(x(:,2)));
plot(freq,substract);
will you give it a try?
HTH,
IH

jingming cao
jingming cao 2017 年 4 月 6 日
good

カテゴリ

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