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

[Matlab] FFT Gaussian x-space -> p-space scalings.

  1. Jul 24, 2010 #1
    Hi There,
    Im having a little trouble with scalings required for a fft performed in Matlab. So here is the story:
    I construct a position space gaussian, plot this guy out to 6 stdDev. My frontfactor is such that my probability density is normalized.
    I know what the actual fourier transform should be in momentum space, thus when I use fft in matlab I should get something that lies ontop of this solution.

    My problem is that I can't, also I cannot really see where things are going wrong. So here is some code to peruse if you're curious about helping,
    Thanks in advance :D

    %A gaussian wavepacket
    asimParam %physical constants [SI units]

    %experimental parameters
    k0=0; %planewave with this wavenumber is modulated by a Gaussian
    w=100e-6; %Gaussian width parameter

    %simulation parameters
    stdDevNum=6; %number of standard deviations before truncation
    disp(['Proportion of total Gaussian within (' num2str(stdDevNum) ') std dev. :'...

    %calculate the maximum momentum to use before truncating the Gaussian, this
    %is done in terms of the maximum number of std. dev. to consider. This can
    %be done because an explicit form of the std dev. is known (See Sakurai)
    grX=1024; %make sure this is base 2pwr as this optimises fft


    %calculate the x-space wavefunction |psi(x,t=0)>

    rhoPsiX=conj(xPsi).*xPsi; %rho as a func of x
    rhoPsiXint=sum(dx*rhoPsiX); %sum of density (step size uniform);

    %Momentum space wavefunction: |phi(p,t=0)>
    %First use the explicit form given in Sakurai, then compare the fft
    %function in Matlab to ensure things are working correctly.
    N=grX; %same number of points as for x-space
    dk=1/(N*dx); %such that fourier transform has correct units
    dp=hb*dk; %now rescale to momentum

    pIn=linspace(-(pMax+hb*k0), (pMax+hb*k0), N)';
    rhoPhiPsInt=sum(dp*rhoPhiPs); %sum of density (step size uniform);

    %Now using Matlab's fft

    %test if it works back to x-space

    %The rest of this m-file is comprised of plotting
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted