# Sine wave harmonics, sawtooth waveform modified

I am trying to find the formula to generate the waveform below. By using harmonics on standard sine waves and then combining the outcomes, I have managed to generate, triangle, sawtooth and square waveforms but I am having great difficulty generating this one. Is there another basic waveform I have missed that is required to generate this wave ?

-
You can make it by adding a triangle wave and a square wave. – Raskolnikov Apr 18 '11 at 11:03
find the fourier coefficients by integrating (if it is simple enough; i cant see the picture) $\int_Tf(x)\cos(2\pi nx/T),\int_Tf(x)\sin(2\pi nx/T)$ – yoyo Apr 18 '11 at 11:09

$$\text{triangle}(x)=\int_0^{x}\text{sign}(\sin(t))dt$$

and

$$\text{square}(x)=\frac{1}{2}(\text{sign}(\sin(x))-1) \; .$$

Here's a description of those waves and their Fourier series:

http://en.wikipedia.org/wiki/Triangle_wave

http://en.wikipedia.org/wiki/Square_wave

-

Raskolnikov's solution works; here is something a bit more elaborate:

$$b\left(\left(\frac{2x}{p}-2\left\lfloor\frac{x}{p}\right\rfloor-\frac12\right) \mathrm{sign}\left(2\left\lfloor\frac{x}{p}\right\rfloor-\frac{2x}{p}+1\right)+\frac12\right)$$

This function was constructed such that the function has period $p$, and that the two linear segments in a period have slopes $b$ and $-b$.

-
Derivation will be supplied upon request. – J. M. Apr 18 '11 at 12:47