matlab beginner: use FFT in matlab and get phase plot
    조회 수: 3 (최근 30일)
  
       이전 댓글 표시
    
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
댓글 수: 0
답변 (2개)
  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
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


