필터 지우기
필터 지우기

matlab beginner: use FFT in matlab and get phase plot

조회 수: 9 (최근 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 CenterFile Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by