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?

Example 1: 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.

Frequency 1.5 phase shift 30 deg

Example 2: 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.

Frequency 2hz phase shift 45 deg

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...

Ps: I will be doing this in Octave 4.0 which is similar to Matlab.

1

There are 1 answers

0
obchardon On BEST ANSWER

It's not a matlab question it's just a mathematical question:

you have:

sin(b1*(x-c1)) = sin(b2*(x-c2))
b1*(x-c1)      =  b2*(x-c2)
c2             = x-(b1*(x-c1))/b2

for c1 = 0, b1 = 1, b2 = 1.5, x = pi/2

c2 = rad2deg(x-(b1*(x-c1))/b2) = 30°