Phase shift measurement
Phase shift measurement
To find the phase shift between two signals (Ch A and B) I:
a) Add a cycle time measurement to Ch A (or B).
b) Use cursors to measure the time delay between signal A and B.
c) Calculate the phase shift from the information above.
Is it possible to implement a measurement into PicoScope 6 that calculates the phase shift (in deg) between Ch A and B.
BR
JanE
a) Add a cycle time measurement to Ch A (or B).
b) Use cursors to measure the time delay between signal A and B.
c) Calculate the phase shift from the information above.
Is it possible to implement a measurement into PicoScope 6 that calculates the phase shift (in deg) between Ch A and B.
BR
JanE
Re: Phase shift measurement
You can do this reasonably well using Maths Channels and the following equation
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
although you have to take the value after the phase settles down as the start conditions are unknown and the first part of the trace will be inaccurate.
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
although you have to take the value after the phase settles down as the start conditions are unknown and the first part of the trace will be inaccurate.
Martyn
Technical Support Manager
Technical Support Manager
Re: Phase shift measurement
One word: Brilliant!
I ran a quick test connecting probe A/B before/after a filter and the phase shift readouts matched the filter's transfer function very well.
Thank you!
BR,
JanE
I ran a quick test connecting probe A/B before/after a filter and the phase shift readouts matched the filter's transfer function very well.
Thank you!
BR,
JanE
Re: Phase shift measurement
Hello,
I am trying to get used to the math functions in 2208B scope. Can you explain the steps in the phase calculation or point me to a paper? It works well. I would like to understand the steps.
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
I am trying to get used to the math functions in 2208B scope. Can you explain the steps in the phase calculation or point me to a paper? It works well. I would like to understand the steps.
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Re: Phase shift measurement
FYI there is newer method around:
"New accurate and fast phase shift calculation formula"
topic31641.html
Example, phase measured on 100MHz sines:
at 50GS/s: 6.387° at ~1MS/s: 6.372° (250x below "practical" Nyquist) Thats also absolute difference of 0.00417%
"New accurate and fast phase shift calculation formula"
topic31641.html
Example, phase measured on 100MHz sines:
at 50GS/s: 6.387° at ~1MS/s: 6.372° (250x below "practical" Nyquist) Thats also absolute difference of 0.00417%
Re: Phase shift measurement
It is a correlation formula
integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B)))
to check A and B where 1 is positive correlation, 0 no correlation, and 1 negative correlation
before scaling to degrees.
If you also remember that integral is calculating the area under a curve, and by doing A*A you are rectifying the signal you should be able to understand the rest.
integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B)))
to check A and B where 1 is positive correlation, 0 no correlation, and 1 negative correlation
before scaling to degrees.
If you also remember that integral is calculating the area under a curve, and by doing A*A you are rectifying the signal you should be able to understand the rest.
Martyn
Technical Support Manager
Technical Support Manager
Re: Phase shift measurement
...and there also lies trap for young players. With this method not only duty cycles but also areas under curve must be exactly identical otherwise calculus is off. phase(A;B) measurement is integral method taken between cursors where it is more less settled:Martyn wrote:If you also remember that integral is calculating the area under a curve, and by doing A*A you are rectifying the signal you should be able to understand the rest.
Actual physical offset is 1.23°
Re: Phase shift measurement
Thanks for all who have helped on phase shift measurement.
When I use (acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180) I get up to a 30% error.
When I use ((((atan(1/tan(pi*(A/10000)))/pi)+(A/10000))*((atan(1/tan(pi*(B/10000)))/pi)+(B/10000)))+0.25)/0.002777777 it matches the cursors.
I would still like to understand how the first formula works.
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Would you say the formula below is what it is doing?
acos(correlation formula)/Pi*180
Thanks / Charles
When I use (acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180) I get up to a 30% error.
When I use ((((atan(1/tan(pi*(A/10000)))/pi)+(A/10000))*((atan(1/tan(pi*(B/10000)))/pi)+(B/10000)))+0.25)/0.002777777 it matches the cursors.
I would still like to understand how the first formula works.
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Would you say the formula below is what it is doing?
acos(correlation formula)/Pi*180
Thanks / Charles
Re: Phase shift measurement
Maybe this helps a little:
https://www.eevblog.com/forum/testgear/ ... msg1106436
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
=>
A*A
integral(A*A)
sqrt(integral(A*A)
sqrt(integral(A*A))*sqrt(integral(B*B))
A*B
integral(A*B)
etc. After you get a visual picture what each part does on specific signal you can put it together and understand. Brain likes visual ques. So even running seemingly basics on known signal like A*A can help sometimes.
https://www.eevblog.com/forum/testgear/ ... msg1106436
Overall to understand the formula you start working "inside out". Something along these lines:It's correlation formula. Will only show phase if the shape is exactly the same (except phase shift). For inphase signals, it'll measure the similarity between waveforms (if you remove "acos" and scaling). It'll be "1" if the signals are completely the same (ignoring scale) and "0" if they're completely dissimilar. "1" will mean the same sinal, but inverted. You can use the formula to measure how similar is your waveform to the sine wave (or any other signal you may want to use as an etalon).
acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
=>
A*A
integral(A*A)
sqrt(integral(A*A)
sqrt(integral(A*A))*sqrt(integral(B*B))
A*B
integral(A*B)
etc. After you get a visual picture what each part does on specific signal you can put it together and understand. Brain likes visual ques. So even running seemingly basics on known signal like A*A can help sometimes.
Re: Phase shift measurement
Thanks very much for explaining this. This is similar to the formula for rms [ sqrt(integral((A)^2)/T) ]
It is easy to see this because the T is the amount of time along the X axis of the display. In the correlation formula how is it able to work without a T? Thanks / Barnett
It is easy to see this because the T is the amount of time along the X axis of the display. In the correlation formula how is it able to work without a T? Thanks / Barnett
Re: Phase shift measurement
BTW there is important topic about TRMS, there are some tricks to getting it work correctly should you experiment with graphing:
topic29531.html
topic29531.html
Re: Phase shift measurement
Hello, Would you check to see if my math is correct. Almost have it.
phase shift degrees = acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Correlation formula:
(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))
(integral(A*B)/(A rms*B rms))
this will give a value between 1 and 1 showing how similar the two waves are.
1 would mean the signals are identical.
0 would mean the two are completely dissimilar.
1 would mean identical signals but opposite polarity.
This is also the power factor cos Θ.
Example:
E & I in a power xfmr to see the phase shift.
V: 115 vac @ 60 Hz
I: 180 ma rms
Phase shift: 44 degrees = 0.768 radians
acos(corr)/Pi*180
acos(0.719)=0.768 radians
0.768/pi=0.2446
0.2446 * 180 = 44 degrees
correlation = (integral(A*B)/(A rms*B rms))
0.719 = (integral(A*B)/(115 *0.180))
0.719 = (integral(A*B)/(20.7))
0.719 = 14.88/20.7
How do you get 14.88 from integral(A*B)
phase shift degrees = acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Correlation formula:
(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))
(integral(A*B)/(A rms*B rms))
this will give a value between 1 and 1 showing how similar the two waves are.
1 would mean the signals are identical.
0 would mean the two are completely dissimilar.
1 would mean identical signals but opposite polarity.
This is also the power factor cos Θ.
Example:
E & I in a power xfmr to see the phase shift.
V: 115 vac @ 60 Hz
I: 180 ma rms
Phase shift: 44 degrees = 0.768 radians
acos(corr)/Pi*180
acos(0.719)=0.768 radians
0.768/pi=0.2446
0.2446 * 180 = 44 degrees
correlation = (integral(A*B)/(A rms*B rms))
0.719 = (integral(A*B)/(115 *0.180))
0.719 = (integral(A*B)/(20.7))
0.719 = 14.88/20.7
How do you get 14.88 from integral(A*B)
Re: Phase shift measurement
Must correlate correlable What you are fundamentally doing here is comparing maximum potential output power (watts) to current output. Which is directly tied to phase between voltage and current.
*n/a with negative integral
Your example simulated: Maximum possible output:
Code: Select all
TRMS(A) = sqrt(integral(A^2)/T)
TRMS(B) = sqrt(integral(B^2)/T)
√P(A*B) = sqrt(integral(A*B)/T)*
ABS(P(A*B)) = sqrt(integral(A*B)/T)^2)
P(A*B) = integral(A*B)/T
MAX(P(A*B)) = (sqrt(integral(A^2))*sqrt(integral(B^2)))/T
Your example simulated: Maximum possible output:
Re: Phase shift measurement
Thanks very much for explaining this. In your code you use T. Where is the T in the equation below?
To calculate an integral you have to have a T don't you.
phase shift degrees = acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
To calculate an integral you have to have a T don't you.
phase shift degrees = acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Re: Phase shift measurement
MAX(P(A*B))
https://www.wolframalpha.com/input/?i=i ... );+0+to+pi
P(A*B)
https://www.wolframalpha.com/input/?i=i ... );+0+to+pi
Code: Select all
integrate (115*sin(x)) * (0.18*sin(x)) * (2/pi); 0 to pi
P(A*B)
Code: Select all
integrate (115*sin(x)) * (0.18*sin(x44pi/180)) * (2/pi); 0 to pi
 Attachments

 phase_shifted.gif (2.86 KiB) Viewed 2337 times

 phase_sync.gif (2.36 KiB) Viewed 2337 times