I'm trying to get the fourier series function(s) to work for a square wave with duty cycles other than 50% ie rectangular wave.
squareWave[t_, period_, duty_] := UnitBox[Mod[t/period, 1.]/(2. duty)]
xx[t_] := squareWave[t, 10, 0.8]
Plot[xx[t], {t, -10, 10}, Background -> Gray]
curvexx = FourierTrigSeries[xx[t], t, 10];
Plot[curvexx, {t, -10, 10}, Background -> Gray]
that's my code, set up squarewave, check by plotting (alright so far), take fourier series, check by plotting and it's wrong but why where did I go wrong?
squareWave
is not defined. Please post complete code: it should be possible to just copy and paste to test it. $\endgroup$FourierTrigSeries
doesn't accept theFourierParameters
-Option. Eliminate that and you get at least a nice image :) $\endgroup$