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?

  • 1
    $\begingroup$ UnitBox[x/(2 Omega)], FourierTransform[UnitBox[x/(2 Omega)], x, \[Xi]], and Plot? $\endgroup$ – Henrik Schumacher Jun 4 '18 at 8:12
  • $\begingroup$ Hi Ashwin and welcome to Mma.SE! Your question needs more from your side, it's hard to understand. Here its considered helpful and polite to show your own efforts and share your data and code attempts in a well formatted form, so we can quickly see the problem you are facing. Please help us to help you and edit your question to explain better what you need. Also, please take the tour, it will help you understand the site. If you write an excellent question it will inspire great answers. $\endgroup$ – rhermans Jun 4 '18 at 9:27
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

enter image description here

Limit[Sin[x]/x, x -> 0] == Sinc[0] == 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}, 
 AxesLabel -> (Style[#, 14, Bold] & /@ {ω, Subscript[Overscript[f, "~"], Ω]})]

enter image description here

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[0], f[0, Ω]}}}]

enter image description here

| improve this answer | |

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.