3
$\begingroup$

I would like to know how to plot the Dirac Delta result of the Fourier transform of the following typical expression

tf = FourierTransform[(A Sin[ω1 t]) + (A2 Sin[ω2 t]), 
      t, ω, FourierParameters -> {1, -1}] // TraditionalForm
$\endgroup$
2
  • 3
    $\begingroup$ You can't plot delta functions because they have "support of measure zero." It's not clear what you really want. Do you want to plot a vertical line at the location of each discrete frequency? $\endgroup$
    – Jens
    Commented Jun 26, 2016 at 17:52
  • $\begingroup$ I want to plot the spectrum of the sum of two sine signals $\endgroup$
    – diego
    Commented Jun 26, 2016 at 22:03

3 Answers 3

5
$\begingroup$

You can replace the delta functions with something you can plot, to get some sort of visualisation. E.g.

Block[{A = 1, A2 = 1.4, ω1 = 40, ω2 = -30, 
  DiracDelta = UnitTriangle}, Plot[Abs[tf], {ω, -50, 50}]]
$\endgroup$
5
$\begingroup$

If your "typical expression" is a discrete sum of sine waves, then we might treat the delta function as the "unit" of the vertical axis and plot the magnitude of the coefficients.

Block[{A = 1, A2 = 1.4, ω1 = 40., ω2 = Sqrt@40.},
 freqs = Cases[tf, DiracDelta[f_] :> Root[f, 1], Infinity];
 DiscretePlot[
  Abs[tf] /. DiracDelta -> DiscreteDelta,
  {ω, freqs},
  AxesOrigin -> {0, 0}]
]

Mathematica graphics

On the other hand, if there's a continuous spectrum, use Plot:

tf = FourierTransform[
   Exp[-t^2] (A Sin[ω1 t] + A2 Sin[ω2 t]), t, ω, 
   FourierParameters -> {1, -1}];
Block[{A = 1, A2 = 7/5, ω1 = 4, ω2 = Sqrt@2},
 Plot[Abs[tf], {ω, -8, 8}, WorkingPrecision -> 50]]

Mathematica graphics

$\endgroup$
4
$\begingroup$

I think there are two different aspects here. First let add to sin signals, say, $\sin[(\omega+\Delta)t]$ and $\sin[(\omega-\Delta)t]$

Manipulate[ Plot[Sin[2 Pi (n + d) x] + Sin[2 Pi (n - d) x], {x, -5 Pi, 5 Pi}],
{n, 1, 10}, {d, 0, 1}]

enter image description here

As you can see the difference in frequency will give you beats. Now let say you want to create a Delta function like spectrum you have to add infinite number of Sin waves with proper weight. I choose here a gaussian weight. I choose Cos to make things symmetric.

Manipulate[Plot[Sum[Exp[-k^2 d^2] Cos[k x], {k, 0, 10, 0.1}], {x, -5 Pi, 5 Pi}, 
PlotRange -> All], {d, 0, 1}]

enter image description here

As you can see by controlling the gaussian width of distribution you can get a nice and sharp spike. For a true Dirac-Delta function you have to take the integration limit for k to infinity.

$\endgroup$

Your Answer

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

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