# Where should triangle, sawtooth and square waves start?

I am reading a text on DSP, which shows generation of sin, cos, triangle, sawtooth and square waves. Generated cos waves start at 1 and sin waves start at 0, which makes sense (cos(0)=1, sin(0)=0). Generated triangle waves start at 1, square waves at -1, sawtooth at -1. Wikipedia gives a number of constructions for square wave, which would lead to starts at 1, -1 or 0.

Is there a convention in the DPS/electrical engineering/oscillosope world on where triangle, sawtooth and square waves should start?

If you look at it on the surface, all periodic waves have phases associated with them such as $$\sin(\omega t + \phi)$$ or $$\cos(2\pi f_0 t + \theta)$$ which has phase angels of $$\phi$$ and $$\theta$$ radians respectively. Therefore, they do not necessarily begin at their peaks at $$t=0$$ always. Indeed at $$t=0$$ above waves assume the values of $$\sin(\phi)$$ and $$\cos(\theta)$$. And you can therefore shift them by amounts of $$\phi$$ and $$\theta$$ left or right to make their phases zero with respect to display graphics plotting systems.

Oscilloscopes make this adjustment by their trigger levels. For example, to set the peak of the signal $$A \cos(2\pi f_0 t + \theta)$$ at the origin ($$t=0$$) then you shall adjust your trigger level to about $$A$$, assuming that the trigger operation will start plotting the wave at that amplitude positioned at the origin of the coordinate grid.

The same should be true for other waveshapes such as sawtooth, triangle, square or many unnamed periodic possibilitied.

I cannot see if you have a deeper question here, but on the surface the the answer is as above.

Plot of $$\text{sgn}( \sin( 2\pi t ) )$$ :

And plot of $$\text{sgn}( \cos( 2\pi t ) )$$ :

• It's not a deep question, it's a shallow one about whether there is a conventional starting point. In terms of your explanation: If I buy a commonly used oscilloscope and turn it on and punch a button for square wave and do not adjust the trigger level, what will be the default phase (0?) and initial level for the square wave. Wiki gives multiple ways of defining square wave which if, say, you converted them to I/Q signals, might result in different phase values for time 0 if you converted the signal into an I/Q representation. – Lars Ericson Jul 1 '19 at 18:35
• @LarsEricson It's all relative. There is no absolute starting point for any waveform. By start if you mean $t=0$, then it's something like $f(0)$ where all the waves start. There is no standard convention starting point. That's why oscilloscopes have the trigger control, to set the starting point anywhere you want. When it's off ( or 0 level) then it's point at which the wave assumes a zero value; for a square wave this would be the falling edge meeting with 0 volt level then... Or possibly the rising edge meeting with 0 volts. Afaik there no standard for it. Why is that so critical ? – Fat32 Jul 1 '19 at 21:22
• It's not, except inasmuch as different ways of defining square wave as f(t) give different levels for f(0) such as f(0)=1 or 0 or -1. I was just wondering if there happened to be a convention in this field, but I guess the answer is No. In particular if I bought oscilloscopes from two different manufacturers, pressed the Square Wave button and left the Trigger Level untouched, I may expect to see different t=0 starting points for the square wave (one of -1, 0 or 1). – Lars Ericson Jul 2 '19 at 0:35
• @LarsEricson If I would generate a square wave I would start it with a +1, and I believe that's the case for most manufacturers. But as I said, in DSP there's no such standard behaviour defined. For electronics industry, they might define some standard signal properties, but not to my knowledge... – Fat32 Jul 2 '19 at 1:26
• OK I think it's luck of the draw. Wikipedia for example shows $square(t)=sgn(\sin 2 \pi f t)$ and $square(t)=sgn(\cos 2 \pi f t)$. So you are saying most manufacturers would implement the 2nd definition. – Lars Ericson Jul 2 '19 at 13:14