inverse Fourier transform without error problem

조회 수: 2 (최근 30일)
Grace
Grace 2021년 9월 6일
댓글: Grace 2021년 9월 6일
I have a MATLAB code that i need to perform inverse fourier transform, but it does not produce any output. It appears that some data points in the frequency domain were skipped, maybe this could be the reason why MATLAB could not perform the inverse fourier transform to time domain.
please, can someone help me to resolve this issue. Pleases find below the code. Thank you in advance for your response.
clear all;close all;clc
%OBJECTIVE OF THIS CODE; Single shot characterisation of a given THZ pulse i.e. to characterize a THz pulse by using chirped pulse
N=1024*2^14;
dt=1e-14;
t=(0:N/2-1)*dt;
df=1/(N*dt);
f=(0:N/2-1)*df;w=2*pi*f;
d = 500e-6;
m=(289.27-(6*(f*1e-12).^2))./(29.16-((f*1e-12).^2));
q=real(sqrt(m));%phase index of THz radiation
s=3.2394;c=3e8;
T=0.15e-12;
first_term=exp(-(w).^2*T.^2/4).*(sqrt(2)*pi*T./(q.^2 - s^2));
second_term=0.5.*(1+ (s./q)).*(exp(i.*w.*q*d./c));
third_term=(0.5*(1- (s./q)).*exp(-i.*w.*q.*d./c));
fourth_term=exp(i.*w.*s.*d./c);
result= first_term.*(second_term + third_term - fourth_term);
RESULT=abs(result).^2;
figure(1);plot(f,RESULT);title('frequency plot')
figure(2);plot(t, ifft(RESULT));title('time plot')

채택된 답변

David Goodmanson
David Goodmanson 2021년 9월 6일
Hi MO,
It turns out that the variable m is positive in most of its range, but is negative for the array elements
>> [min(find(m<0)) max(find(m<0))]
ans = 905971 1164920
because the denominator of the expression for m is negative and the numerator is positive. Since you define q as
q=real(sqrt(m)),
q = 0 in that region. The 2nd and 3rd terms contain a factor of s/q, so the 2nd and 3rd terms are infinite in that region, and subtracting the 2nd and 3rd terms means that the result has nans in that region. You can plot result or RESULT since plotting ignores nans. But the ifft doesn't work.
So you will need to decide what q should be doing when m is negative.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Fourier and Cosine Transforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by