Can you measure phase between two quadrature signals (I,Q)without using FFT? I know how to do it using FFT but is there a quicker,easier way?
Well, if they ARE quadrature signals, they should be 90 degree phase shift compared to each other.
If I need to measure, for some reason, I would measure the time delay between (lets say) positive slope zero crossing of one signal and the other. That is, start count on positive slope zero crossing of one, then stop at positive slope zero crossing of the other. If you further need to measure the period in order to compute the angle, then start a second timer at the positive slope zero crossing of the first, and stop it at the next positive slope zero crossing of the same signal.
Until Black Lives Matter, we do not have "All Lives Matter"!
What is the context of the problem? Wireless decoding (GSM), rotary encoders, mouse wheels?
Measuring phase differences in a time domain rather than the frequency domain -maybe look at correlation techniques?
More info required.
P.S. Analog or digital?
if the I-Q signals are DC, that means
that your local oscillator used to
get the I-Q signals has the same frequency
as the received signal.
Then atan2(I,Q) is the phase between the
received signal and the LO signal.
If the I/Q signals are slowly varying, then
atan2(I,Q) is the slowly varying phase.
Don't suppose a phase detector chip would do the job?
4046 PLL comes to mind.
I used the method Jim suggested, measure the time elapsed between zero crossing...
There is an example of the code and circuit in the projects section, "Ultrasonic Resonant Tracking"...
Ok thats very informative. What I have is a set of samples from an I signal for one cycle and another set of samples from a Q signal for one cycle. The frequency is the same.
Yes, I know the phase diff. is 90 degrees. What I want to know is how much does the phase change (delta) around 90 deg.
What I was thinking is represent the sampled data as I + j Q and then take arctan(Q/I) for each sample to see the phase for each sample. This would be the instantaneous phase difference between I and Q. I could take the average then and find the overall delta between I and Q. I have used MATLAB to plot the phase vs. frequency plot, but a simple arctan should be ok right?
To get much accuracy, that way, you will have to take a LOT of samples per cycle. At 10 samples per cycle, you get 36 degree resolution. At a hundred, it is still only 3.6 degrees.
If you are just pumping out raw sample values for MATLAB to analyze, then you could use inverse trig functions as you suggest, but, I would compute it point-by-point over a full cycle, then average. Trying to do this in the micro has a huge software cost due to floating point demands, then transcendental functions,
I don't see why you don't just measure period and phase delay and determine angle from that. You are still constrained, however, by sample rate.
ok right now I have a column of I samples and Q samples and I took Q/I and calculated arctan of this to get my phase for each sample.
When I plot the phase vs. sample number I get 10 (sawtooth like) cycles in which the phase changes from about 85 degrees down to -85 degrees and then again jumps up to 85 on the second cycle and so on.
I have 10 cycles each of 32 samples for both I and Q.
What I want to calculate is the phase imbalance between I and Q.
Right now, sample #1 has the peak of the cycle and it is about 85 degrees but changes from cycle to cycle.(for e.g. it could be 87 on the cycle # 2 but it is close to 90)
So would it be ok to select the same sample number (say for e.g. sample #1) on each cycle and average it over 10 cycles and subtract the result from 90 to get the phase imbalance? For e.g. if sample 1 on ten cycles read:
Taking the average would give me : 85.6 and therefore the phase imbalance would be 4.4 degrees?
I know this would be a very coarse measurement but is it technically accurate?
I'm not 100% sure what you are doing but for me it sounds like some form of FM decoding. The best way (other than the normal artan) is to make a complex VCO and a software PLL to track the signal.
Edit: A good book for this is
Digital Signal Processing in Communication Systems
by Marvin E. Frerking
Sounds like a frerking good read!
What do you mean by phase-imbalance ?
You better use atan2(x,y). This gives the correct
phase over the total range -pi,..,pi.
The linearly varying phase shows you, that your
local oscillator has a slightly different frequency
with respect to the incoming (measured) signal.
The rate of phase-change simply is the ddifference in
Could you describe the setup and what you
want to do with it ?
© 2020 Microchip Technology Inc.