# 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 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 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 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 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 at 13:14
{"ft_lang_label":"__label__en","ft_lang_prob":0.8861058,"math_prob":0.9942432,"size":1175,"snap":"2019-43-2019-47","text_gpt3_token_len":304,"char_repetition_ratio":0.10076857,"word_repetition_ratio":0.01980198,"special_character_ratio":0.26893616,"punctuation_ratio":0.07522124,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9980266,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-21T19:31:02Z\",\"WARC-Record-ID\":\"<urn:uuid:aaae16c6-35e0-4a81-90c4-da6b83f6ef89>\",\"Content-Length\":\"140948\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:c1a3c8a9-db37-43f8-ad8d-5a1e13e3e3f3>\",\"WARC-Concurrent-To\":\"<urn:uuid:602ee17e-f830-4ae2-949a-b6c9dba5e4b9>\",\"WARC-IP-Address\":\"151.101.1.69\",\"WARC-Target-URI\":\"https://dsp.stackexchange.com/questions/59203/where-should-triangle-sawtooth-and-square-waves-start\",\"WARC-Payload-Digest\":\"sha1:LHPHU3W76RMCFWWZQAXI7FMQLIJDWIGP\",\"WARC-Block-Digest\":\"sha1:66K4KOQUBKXHUIISZEFVBEIALS72Q37S\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496670948.64_warc_CC-MAIN-20191121180800-20191121204800-00484.warc.gz\"}"}