0
$\begingroup$
xdomain = Table[i , {i, -10, 10, .1}];
ListPlot[InverseFourier[
  Fourier[E^-#^2 & /@ xdomain]*E^#^2 & /@ xdomain]]

So I want to numerically fourier transform a function, multiply that fourier'd function by a second function, and then inverse fourier transform it.

The code above doesn't work. I get a blank graph, I think, because it doesn't properly multiply the two vectors that I commanded to multiply. I'm not sure why I can't get {a,b,c}*{1,2,3} to multiply inside my fourier function, but I have tried putting evaluate functions in different spots inside to see if that would fix it.

$\endgroup$

2 Answers 2

4
$\begingroup$
  1. You need brackets around E^#^2 & /@ xdomain
  2. ListPlot plot only real lists so you need to apply Re, Im or Abs
  3. E^-#^2 & /@ xdomain is overkill. Just Exp[-xdomain^2]

    xdomain = Range[-10, 10, 0.1];
    
    ListPlot[Re@InverseFourier[Fourier@Exp[-xdomain^2] Exp[xdomain^2]]]
    

enter image description here

P.S. It seems that you want to apply a deconvolution. The method with the inverse Fourier transform is unstable. For this purpose there is a stable build-in function ListDeconvolve.

$\endgroup$
2
  • $\begingroup$ Thanks for the help. Do you think you could help me out with using ListDeconvolve in this context? I cannot find very much material on it's use. How do I know what method and kernel I should use to deconvolve the system? $\endgroup$ Oct 20, 2013 at 3:56
  • $\begingroup$ @StevenSagona It depends on the system. Your kernel is Gaussian so GaussianMatrix should be a good choice. For 1D system you can use it as GaussianMatrix[{{r}, {σ}}] where σ is a standard deviation and r is a radius of the kernel (must be several times more than σ). $\endgroup$
    – ybeltukov
    Oct 20, 2013 at 10:51
2
$\begingroup$

Oneliners can be elegant, but sometimes they burdens Mathematica a bit too much. Let's do it one step at the time:

xdomain = Table[i, {i, -10, 10, .1}];
F1= E^-#^2 & /@ xdomain; (* no problem here *)
F2 = E^+#^2 & /@ xdomain; (* no problem here *)
ftot=InverseFourier[Fourier[F1]*F2]; (* no problem here *)

The problem, then, is not in the multiplication. So, where is it? Well, the problem is that ftot is a complex function. You can plot its magnitude, its phase or its real and imaginary part. But if you try to listplot it as it is, you will get a blank graph. Perhaps you want:

ListPlot[Abs[ftot]]

Mathematica graphics

or

ListPlot[Re[ftot]]

Mathematica graphics

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.