Sawtooth wave as a sum of sines

1.4k Views Asked by At

Wikipedia gives the equation for a sawtooth waveform composed as a sum of sines as:

$$ x_\mathrm{sawtooth}(t) = \frac{A}{2}-\frac {A}{\pi}\sum_{k=1}^{\infty}\frac {\sin (2\pi kft)}{k} $$

Where $A$ is amplitude.

Is that correct? My reading of that (and graphs thereof) suggest that the initial term ($A/2-$) biases the resulting graph to positive values, so that instead of being centered around $0$ it will be centered around something $> 0$.

In comparison, they give the formula for a reverse sawtooth wave as:

$$ x_\mathrm{reversesawtooth}(t) = \frac {2}{\pi}\sum_{k=1}^{\infty} {(-1)}^{k} \frac {\sin (2\pi kft)}{k} $$

This yields values centered around 0, which is pretty much what I expected.

Simply dropping the initial term from the original expression, so that I have...

$$ x_\mathrm{sawtooth}(t) = -\frac {A}{\pi}\sum_{k=1}^{\infty}\frac {\sin (2\pi kft)}{k} $$

...yields an output range that is centered around $0$. I am writing some very simple code that deals with audio signal generation and I just want to fact check what I am doing. Is the Wikipedia page sloppy, or am I off base?