# Problem with Fourier transform How to define a top hat function with plot also at opening and closing value? and

How to plot a Fourier transform of the function?

• UnitBox[x/(2 Omega)], FourierTransform[UnitBox[x/(2 Omega)], x, \[Xi]], and Plot? Jun 4 '18 at 8:12

Clear[f, F]


As recommended by Henrik Schumacher you can use UnitBox

F[ω_, Ω_: 1] := UnitBox[ω/(2 Ω)];

f[t_, Ω_: 1] = FourierTransform[F[ω, Ω], ω, t] // Simplify[#, Ω > 0] &

(* Sqrt[2/π] Ω Sinc[t Ω] *)


Note that Sinc[x] is preferable to Sin[x]/x since it is defined for x == 0 without having to take the Limit

Sin[x]/x /. x -> 0 Limit[Sin[x]/x, x -> 0] == Sinc == 1

(* True *)


You could also use UnitStep

F[ω_, Ω_: 1] := UnitStep[ω + Ω] - UnitStep[ω - Ω]

Show[plt = Plot[F[ω], {ω, -1.2, 1.2}, Exclusions -> None],
Ticks -> {AbsoluteOptions[plt, Ticks][[1, -1, 1]] /.
{x_?NumericQ, xl_?NumericQ, rest___} :> {x, Ω*Rationalize[xl], rest},
Automatic},
AxesLabel -> (Style[#, 14, Bold] & /@ {ω, Subscript[Overscript[f, "~"], Ω]})] f[t_, Ω_: 1] = FourierTransform[F[ω, Ω], ω, t] /. Sin[x_] :> x Sinc[x]

(* Sqrt[2/π] Ω Sinc[t Ω] *)

Plot[f[t], {t, -5 Pi, 5 Pi}, PlotRange -> All,
AxesLabel -> (Style[#, 14, Bold] & /@ {t, Subscript[f, Ω][t]}),
Ticks -> {{{Pi, Pi/Ω}}, {{f, f[0, Ω]}}}] 