# how to plot the amplitude and phase spectrum of a Fourier Transform in this specific pattern?

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.

• 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. – Mike Colacino May 10 '20 at 21:26

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}];


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


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


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"}},
ScalingFunctions -> {{"Log10", "dB"}, {"Log10", "Degree"}},
BaseStyle -> 14]


## Hard way

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


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


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"}},

• You could just do ft = FourierTransform[...]; BodePlot[ft /. a -> 1, w]. – Suba Thomas May 11 '20 at 12:52
• @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? – Nasser May 11 '20 at 19:33
• 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. – Suba Thomas May 11 '20 at 21:32
• 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. – Suba Thomas May 11 '20 at 21:33