```Hi,

Conceptually:

a) Multiply your first stream with the complex sequence exp(-j*2*pi*f*t)
The purpose is to downconvert your "f" of interest to 0 Hz
b) Do the same for the other stream
c) low-pass filter both results. This is the tricky part, unless your
signal is cyclic - for example one OFDM symbol length. In this case, just
average over the cycle length. In any case, you'll get a complex number
for each. Compare them.

In reality, if your signal is cyclic anyway
- U=fft one cycle of stream A, no windowing
- V=fft one cycle of stream B, no windowing
-look into the appropriate fft bin and compare the two values

Hope that makes some sense :)

Cheers

Markus
```
```Jerry Avins wrote:
(I wrote)
>> I would think you could still do it for almost the same frequency,
>> but maybe that is pretty much the same thing.

> How would you compare the phase of a signal at 1 MHz with another at
> 1.2? When would you compare the phase of a signal at 1 MHz with another
> at 1.2? What if the ratio were irrational?

If it is comparison of phases then it is just the phase difference
between them.

Say it is 1MHz and 1.000000000001MHz.  (That is, (1+1e-12) MHz)
If you look at them for a few seconds and don't measure extremely
carefully you will find the phase difference constant.  If you
look sometime later, it will again seem to be constant, but different
relative phase than it was originally.  The phase shift goes through
a full cycle every 1e6 seconds.

Or, instead compare the carrier and USB modulated signal with
a 0.000001Hz sine modulation.  The phase shift is uniform with
one cycle every 1e6 seconds.

Now, same argument with a larger frequency difference, but the
relative phase changes faster.

I remember in optics lab measuring the interference between two
HeNe lasers, which varies as the frequencies are not exactly the same.
That is the first example I thought of as a phase difference between
different frequency signals.

-- glen

```
```glen herrmannsfeldt wrote:
> Jerry Avins wrote:
>
>> Tim Wescott wrote:
>
>>> I got out of it that the OP wants to compare phase and magnitudes at
>>> different frequencies -- but perhaps you're right and he's confused.
>
>> A comparison of phases has meaning only when the signals have the same
>> frequency. Arbitrary ad-hoc definitions can be used when the
>> frequencies differ, but they have to be explicitly stated.
>
> I would think you could still do it for almost the same frequency,
> but maybe that is pretty much the same thing.

How would you compare the phase of a signal at 1 MHz with another at
1.2? When would you compare the phase of a signal at 1 MHz with another
at 1.2? What if the ratio were irrational?

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```Jerry Avins wrote:

> Tim Wescott wrote:

>> I got out of it that the OP wants to compare phase and magnitudes at
>> different frequencies -- but perhaps you're right and he's confused.

> A comparison of phases has meaning only when the signals have the same
> frequency. Arbitrary ad-hoc definitions can be used when the frequencies
> differ, but they have to be explicitly stated.

I would think you could still do it for almost the same frequency,
but maybe that is pretty much the same thing.

-- glen

```
```Tim Wescott wrote:

...

> I got out of it that the OP wants to compare phase and magnitudes at
> different frequencies -- but perhaps you're right and he's confused.

A comparison of phases has meaning only when the signals have the same
frequency. Arbitrary ad-hoc definitions can be used when the frequencies
differ, but they have to be explicitly stated.

...

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```On Wed, 01 Aug 2007 08:37:27 -0400, Jerry Avins wrote:

> abathla wrote:
>> Hi
>> I got two quadrature input streams, I and Q. I need to find phase and
>> magnitude at a particular frequency for both of them and then compare
>> these values. Is goertzel the fastest way to do it.
>
> According to what you write, you want to compare phase to frequency.
> They are not comparable.

I got out of it that the OP wants to compare phase and magnitudes at
different frequencies -- but perhaps you're right and he's confused.
>
>> Also, is goertzel algorithm valid if the frequency is not a multiple of
>> fs/N.
>
> Yes, but that doesn't seem to be widely known.

You can, but you have to account for the fact that you haven't completed
an integer number of cycles, so you have to use both states of the filter
in your power computation.  This is also less widely known.
>
>> where fs = sampling frequency
>> N = no of samples.
>> Do i have to use cos(2.pi.k/N) or can i also use cos(2.pi.freq/fs)(
>> where freq = target frequency which may/may not be a multiple of fs/N.)
>> in the goertzel algorithm.
>
> Isn't that the same question again?
>
> Jerry

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
```
```abathla wrote:
> Hi
> I got two quadrature input streams, I and Q. I need to find phase and
> magnitude at a particular frequency for both of them and then compare
> these values. Is goertzel the fastest way to do it.

According to what you write, you want to compare phase to frequency.
They are not comparable.

> Also, is goertzel algorithm valid if the frequency is not a multiple of
> fs/N.

Yes, but that doesn't seem to be widely known.

> where fs = sampling frequency
> N = no of samples.
> Do i have to use cos(2.pi.k/N) or can i also use cos(2.pi.freq/fs)( where
> freq = target frequency which may/may not be a multiple of fs/N.) in the
> goertzel algorithm.

Isn't that the same question again?

Jerry
--
Engineering is the art of making what you want from things you can get.
&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;&macr;
```
```Hi
I got two quadrature input streams, I and Q. I need to find phase and
magnitude at a particular frequency for both of them and then compare
these values. Is goertzel the fastest way to do it.
Also, is goertzel algorithm valid if the frequency is not a multiple of
fs/N.
where fs = sampling frequency
N = no of samples.
Do i have to use cos(2.pi.k/N) or can i also use cos(2.pi.freq/fs)( where
freq = target frequency which may/may not be a multiple of fs/N.) in the
goertzel algorithm.

```