title: How can I calculate what the phase shift needs to be so I can get two signals with different frequencies to line up at 90 degs or pi/2?
body: <p>How can I calculate what the phase shift needs to be so I can get two signals with different frequencies to line up at 90 degs or pi/2?</p>
  
  <p><code>Example 1:</code>
  The blue line is 1hz and you can see where the 90 or pi/2 is located (the green vertical line)
  The red line is 1.5hz to get both signals to line up with thier corresponding 90 deg phase shifts it looks like I need to shift the red line 30 degrees.</p>
  
  <p><a href="https://i.stack.imgur.com/2Hcd5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2Hcd5.png" alt="Frequency 1.5 phase shift 30 deg"></a></p>
  
  <p><code>Example 2:</code>
  The blue line is 1hz and you can see where the 90 or pi/2 is located (the green vertical line)
  The red line is 2hz to get both signals to line up with thier corresponding 90 deg phase shifts it looks like I need to shift the red line 45 degrees.</p>
  
  <p><a href="https://i.stack.imgur.com/YepRK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YepRK.png" alt="Frequency 2hz phase shift 45 deg"></a></p>
  
  <p><strong>How can I mathematically calculate what the phase shift needs to be for the red line to have thier corresponing 90 deg phase shifts line up to the blue line if the red line frequency is 0.845hz, 45.453hz, etc...</strong></p>
  
  <p>Ps: I will be doing this in Octave 4.0 which is similar to Matlab.</p>