MATLAB Inverse Fourier Transform using MATLAB

AI Thread Summary
The discussion centers on performing an inverse Fourier transform using MATLAB's IFFT function, specifically addressing confusion about input specifications. The user seeks clarity on how to define their function y(iw) and the real value z within MATLAB's IFFT, which only accepts a single input vector X. The continuous inverse Fourier transform is referenced, highlighting the integral formulation. A user shares a MATLAB code snippet that demonstrates how to compute the Fourier transform of a function and plot its real and imaginary components. Additionally, there is a query about plotting multiple figures in separate windows. The conversation includes a suggestion to explore Mathematica's Fourier Transform capabilities as a potential alternative. Overall, the thread emphasizes practical coding solutions and clarifications for using MATLAB in this context.
orstats
Messages
14
Reaction score
0
I would like to do an inverse Fourier transform using MATLAB's IFFT. I am confused by MATLAB'S single input of X for its IFFT function. Has anyone had experience using MATLAB for these tranforms?

I would like to do an inversion of Fourier transform for my function y(iw) at some value real value z. I am confused at how to specify my function y(iw) and z in MATLAB's IFFT(X).

In the continuous setting, the inverse Fourier transform, ift(), would be

ift(z) = 1/2pi * Integral [ e^(-iwz) y(iw) dw ]

In other words, I specify z and specify y, which is only a function of w which I am integrating over. But how do I do this using MATLAB's IFFT, when it only takes an input X...

Does anyone have any recommendations of computationally solving these integrals for vectors of z and known analytical expression of y(iw)?
 
Physics news on Phys.org
HI!

wahoooooooooo, the similar problem took couple days for me couple weeks ago! and i was so frustrated in that time...

Because this is not a physics problem and you are not suppose to think what Matlab designers liked to use as command! i think i am allowed to just copy all my work for you so you can learn the right commands to use ;)

sorry that i don't have time to look cerefully to your problem (i am working on some other Matlab programs! ) but i am sure the below program will help you :

----------------------------------------

% problem set 3
%
% the function f and it's Fourier (inverse Fourier in Matlab) transform with diffrent methods
% wm = w(mn)
% W = w
% T = Life time
% tn= time variable
% f in my funtion

%part a:

tn=[0:0.01:30];
T=1/(0.3);
wm=4;
f=exp((-i.*wm.*tn)-(tn/T));
plot(tn,real(f),tn,imag(f))
%part b
%In this part I had found the Fourier transition analetically myself and i
%will plot the real and imaginary parts seperated

T=1/(0.3);
wm=4;
w=[0:0.1:10];

for(i=1:length(w))
%the real part of Fourier transform of f
R(i)=(1/T) /( (2*pi)*(((w(i)-wm)^2)+(1/(T^2))));
%%the imaginary part of Fourier transform of f
I(i)=(1/(2*pi))*((w(i)-wm)/(((w(i)-wm).^2)+(1/(T.^2))));
end

hold
plot(w,R,w,I)
plot(w,abs(R).^2,w,abs(I).^2)%part c
%In this part i have to let MatLab to find the Fourier transformation and
%plot the real and imaginary parts and comper them with the part b which
%was the same problem but it was anatletically. the poin is is can make my
%spacing farther in this part to see the diffrence more, i.e. in case of N=50

N=500;
Tmax=50;
T=1/(0.3);
wm=4;

for (p=1:N)
tn(p)=(Tmax/N)*p;
wk(p)=((2*pi)/Tmax)*p;
f(p)=exp(-j*wm*tn(p)) * exp(-tn(p)/T);
% j is the imajinary element which is mostly defined by i but Matlab
% has problem with i so we wrote j and Matlab jot it! ;)
end

F=ifft(f);
%size(F)
%size(wk)
%plot(tn,real(f))
hold
plot(wk,real(F),wk,imag(F))
plot(wk,abs(real(F)).^2,wk,abs(imag(F)).^2)---------------------------------

good luck! ;)
 
I need to know how can i plot different figures in different windows and have all those windows open separately simultaneously? any idea?
 
It depends on what the aim. If it is simply to view them at once, without using MATLAB, you can simply insert the n figures in n panels in an editor, such as MS Word.
 
Btw, thank you for your sample code. You may also find this offering by Mathematica interesting:

website slash slash
reference.wolfram.com/mathematica/FourierSeries/tutorial/FourierSeries.html

Your expression f() for which you are taking the Fourier transform, you may express as an input for their Fourier Transform function. I wonder what were MATLAB's challenges in conceptualizing and implement this...?
 
cool! well...! i don't know! i have to look for it... ;)
 

Similar threads

Replies
10
Views
3K
Replies
2
Views
2K
Replies
7
Views
2K
Replies
5
Views
2K
Replies
0
Views
2K
Replies
4
Views
3K
Replies
2
Views
3K
Back
Top