Triangle wave equation

5.4k Views Asked by At

I have a triangle wave equation represented as $$ y = \dfrac{A \cdot \left(P - \lvert\;\left(x \mod (2 \cdot P) \right) - P \;\rvert\right)}{P} $$ where $A$ is the amplitude and $P$ is half of the period.

This equation starts at $(0,0)$. However, I would like the equation to start from an arbitrary point $(x,y)$. I can shift the wave vertically, but not horizontally. Is there any way to do that?

If it isn't possible with this equation, is there any general equation representing a Triangular wave with user defined starting point?

2

There are 2 best solutions below

1
On BEST ANSWER

Shifting to the right by $x_0$ is accomplished by $$y = \left(\frac A P\right)(P - \lvert(x - x_0) \text{ mod } (2P) - P\rvert).$$

0
On

First, look at this article in Wikipedia. https://en.wikipedia.org/wiki/Sine_wave

Second, this equation is a starting point for the triangle wave. sin y = cos x