MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

# Thread Subject: using ifft to get original signal back

 Subject: using ifft to get original signal back Date: 18 Apr, 2012 17:42:09 Message: 1 of 2 I have two equations, one in the frequency domain (gf) and the other one in the time domain (gt). I used ifft to reconstruct the original function in the time domain (gt2). However, I couldn’t get back the original one. I was thinking there might a scaling issue. So, I applied followings: gt2.*N, gt2./N, gt2.*df, … none of them worked! this is my code: % Time and frequency range T=1000; df=1/T; N=60000; f=eps:df:(N-1)*df; % Frequency range t=T/2*linspace(eps,1,N); w=2*pi.*f; % Angular frequency %Function in the frequency domain alph=(1+i).*sqrt(w/2); gf=((1./(2*alph))).* exp(-alph.*2);   %Function in the time domain gt = exp(-1./t)./(4*pi*t).^(1/2);   % Inverse Fourier transform  gt2=ifft(gf,N);  figure(1)  plot(t,real(gt))  figure(2)  plot(t,real(gt2)) I also changed my time and frequency range to include both positives and negatives (to see if that make a change) as the following. (A small value of eps was also added to each t or f in the equations to avoid NaN in zero frequency and time). I also applied ifftshift and switched positive and negative time components gt22= ifft(ifftshift(gf)), gt2 = [gt22((round(N/2)+1):end) gt22(1:round(N/2))]; but it gave me a weird shape! %New time and frequency range df = 0.01; fmax=10; f = -fmax:df:fmax; dt=1/(2*fmax);tmax=round((1/df)/2); t = -tmax:dt:tmax; N = length(f);   I also saw a similar post on this problem but it didn't help me . I would appreciate your help and suggestion. Thank you sharmin
 Subject: using ifft to get original signal back From: Matt J Date: 18 Apr, 2012 18:23:10 Message: 2 of 2 "sharmin shamsalsadati" wrote in message ... > I have two equations, one in the frequency domain (gf) and the other one in the time domain (gt). I used ifft to reconstruct the original function in the time domain (gt2). However, I couldn’t get back the original one. I was thinking there might a scaling issue. So, I applied followings: gt2.*N, gt2./N, gt2.*df, … none of them worked! this is my code: > > % Time and frequency range > T=1000; > df=1/T; > N=60000; > f=eps:df:(N-1)*df; % Frequency range > t=T/2*linspace(eps,1,N); > w=2*pi.*f; % Angular frequency > > %Function in the frequency domain > alph=(1+i).*sqrt(w/2); > gf=((1./(2*alph))).* exp(-alph.*2); > > %Function in the time domain > gt = exp(-1./t)./(4*pi*t).^(1/2); =================== I doubt you can use discrete transforms to transform functions like these with singularities at the origin.

## Tags for this Thread

### What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us