Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Inverse Fourier Transform using MATLAB

  1. Jun 1, 2008 #1
    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)?
     
  2. jcsd
  3. Jun 1, 2008 #2
    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! ;)
     
  4. Jun 1, 2008 #3
    I need to know how can i plot different figures in different windows and have all those windows open separately simultaneously? any idea?
     
  5. Jun 2, 2008 #4
    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.
     
  6. Jun 2, 2008 #5
    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...?
     
  7. Jun 3, 2008 #6
    cool! well............! i don't know! i have to look for it... ;)
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Inverse Fourier Transform using MATLAB
Loading...