3
$\begingroup$

I'd like to plot the Amplitude, and phase angle spectrum of the FourierTransform[Exp[-a t] UnitStep[t], t, ω, FourierParameters -> {1, -1}] (The Fourier transform is gonna be: 1/(a + I ω))

I'm new to Mathematica; I'd like to plot this by keeping a as a variable in the plot. In other words: Horizontal axis (ω) is from -2 a to 2 a (exactly in this sorting: -2 a, -a, 0, +a, +2 a.) (obviously, the plot has to be continuous but i'd like these horizontal axis points to appear as bold dots on the continuous plot. also please mention another version in which the horizontal axis points form a discrete plot(not continuous anymore). Thanks in advance.

$\endgroup$
1
  • 1
    $\begingroup$ Welcome to StackExchange. You might want to consider using the code markup feature provided by the site for commands like FourierTransform. Not so critical for this post but if you provide more code it makes things much more legible. $\endgroup$ – Mike Colacino May 10 '20 at 21:26
7
$\begingroup$

I'll show the easy way, then the hard way.

Easy way

Since the Fourier transform is the Laplace transform when real of s is zero, then you can use BodePlot

ft = FourierTransform[Exp[-a t] UnitStep[t], t, w, FourierParameters -> {1, -1}];

Mathematica graphics

ft = ft /. (I*w) -> s

Mathematica graphics

BodePlot[TransferFunctionModel[(ft /. a -> 1), s]]

Mathematica graphics

You can improve the plot like this

ft = FourierTransform[Exp[-a t] UnitStep[t], t, w, FourierParameters -> {1, -1}]
ft = ft /. (I*w) -> s    
tf = TransferFunctionModel[(ft /. a -> 1), s];
BodePlot[tf, GridLines -> Automatic, ImageSize -> 400,
 FrameLabel -> {{{"magnitude (db)", None}, {None, "Bode plot"}},
   {{"phase(deg)", None}, {"Frequency (rad/sec)", None}}},
 ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
 BaseStyle -> 14]

Mathematica graphics

Hard way

ft = FourierTransform[Exp[-a t] UnitStep[t], t, w, FourierParameters -> {1, -1}];
LogLinearPlot[20*Log10[Abs[(ft /. a -> 1)]], {w, 0, 10}]

Mathematica graphics

 LogLinearPlot[Arg[(ft /. a -> 1)]*180/Pi, {w, 0, 10}]

Mathematica graphics

Extra credit

Here is a Manipulate

Manipulate[
 Module[{ft, t, s, w, tf, a0},
  ft = FourierTransform[Exp[-a0 t] UnitStep[t], t, w, 
    FourierParameters -> {1, -1}];
  ft = ft /. (I*w) -> s;
  tf = TransferFunctionModel[(ft /. a0 -> a), s];
  BodePlot[tf, GridLines -> Automatic, ImageSize -> 400,
   FrameLabel -> {{{"magnitude (db)", None}, {None, "Bode plot"}},
     {{"phase(deg)", None}, {"Frequency (rad/sec)", None}}},
   ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}}, 
   BaseStyle -> 14]
  ],
 {{a, 1, "a"}, .1, 10, .1, Appearance -> "Labeled"},
 ContinuousAction -> False,
 TrackedSymbols :> {a}
 ]

Mathematica graphics

$\endgroup$
4
  • 1
    $\begingroup$ You could just do ft = FourierTransform[...]; BodePlot[ft /. a -> 1, w]. $\endgroup$ – Suba Thomas May 11 '20 at 12:52
  • 1
    $\begingroup$ @SubaThomas at school we only learned to use Bode on Laplace transforms. That is why I changed it. But why does they give different output? i.e. compare ft = FourierTransform[Exp[-a t] UnitStep[t], t, w, FourierParameters -> {1, -1}]; BodePlot[TransferFunctionModel[(ft /. a -> 1), w]] to the following ft = ft /. (I*w) -> s; BodePlot[TransferFunctionModel[(ft /. a -> 1), s]]. They do not look the same. Specially the phase plot? $\endgroup$ – Nasser May 11 '20 at 19:33
  • 2
    $\begingroup$ More likely you forgot all of the details you learnt :). Given the transfer function $1/(s+a)$ in terms of the Laplace variable $s$, to get the BodePlot we first have to obtain the sinusoidal transfer function $1/(s+ i\ w)$ in terms of the frequency (Fourier) variable $w$. In some situations, as is the case here when we have the sinusoidal transfer function, computing the transfer function is a round trip operation. $\endgroup$ – Suba Thomas May 11 '20 at 21:32
  • 2
    $\begingroup$ The usage of TransferFunctionModel is TFM[tf in terms of Laplace variable, Laplace variable] not TFM[sinusoidal transfer function, frequency variable]. (For discrete-time it is the Z-transform and frequency variables.) To see the sinusoidal transfer function in each case do TransferFunctionModel[(ft /. a -> 1), w][I w] and you will see they are $1/(1-w)$ and $1/(1+i\ w)$ and hence the discrepancy. $\endgroup$ – Suba Thomas May 11 '20 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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