0
$\begingroup$

Let's take a switch function as an example:
$ u(t)= \begin{cases} 1, & \text{$0<t<dT_s$} \\ 0, & \text{$dT_s<t<T_s$} \end{cases} $
How can I get Fourier series of it in Mathematica?
Is there a way to get Fourier series of arbitrary periodic piecewise function?

$\endgroup$
  • 2
    $\begingroup$ I would start by having a look at Piecewise and Fourier. $\endgroup$ – b.gates.you.know.what Feb 26 at 9:09
  • $\begingroup$ @b.gatessucks You probably meant FourierSeries, right? Fourier is the discrete fourier transform (FFT). I am also puzzeld by the many different Fourier-related commands in Mathematica. $\endgroup$ – Henrik Schumacher Feb 26 at 10:11
  • $\begingroup$ @HenrikSchumacher Indeed, thanks for pointing that out. $\endgroup$ – b.gates.you.know.what Feb 26 at 10:37
  • $\begingroup$ Strongly related, if not duplicate: mathematica.stackexchange.com/q/149468/1871 $\endgroup$ – xzczd Feb 26 at 10:39
  • $\begingroup$ People here generally like users to post code as Mathematica code instead of just images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find this this meta Q&A helpful $\endgroup$ – Michael E2 Feb 26 at 14:29
2
$\begingroup$

for example:

u[t_] = Piecewise[{{1, 0 < t < dT}, {0, dT < t < T}}];
FourierTrigSeries[u[t], t, 3, FourierParameters -> {1, 2 \[Pi]/T}, 
 Assumptions -> 0 < dT < T && 2 dT == T]

enter image description here

$\endgroup$
1
$\begingroup$

Try u[t_] := UnitStep[Sin[t]]; FourierSeries[u[x], x, 3] 3 is series

$\endgroup$
  • 1
    $\begingroup$ One might want to be mindful of the FourierParameters setting when using FourierSeries[] and other sundry functions, lest Mathematica's chosen normalization might not be the same as your preferred one. $\endgroup$ – J. M. is away Feb 26 at 9:15

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.