# Calculating instantaneous phase of a simple signal

Started by February 29, 2008
```OK, say I have the signal:

signal=(sin(2*%pi*77.7811 .* x) + .39*sin(2*%pi*74.7811 .* x) +
.34*sin(2*%pi*81.3811 .* x));

From this I know: the real part of the signal is identical to the signal,
and the imaginary part is:

Q = (-cos(2*%pi*77.7811 .* x) - .39*cos(2*%pi*74.7811 .* x) -
.34*cos(2*%pi*81.3811 .* x));

Since the Hilbert transform of a sin(x) = -cos(x).

Using this, I can find the amplitude envelope of signal by calculating:

a = sqrt(I^2 + Q^2)

This works perfectly, when I plot "a" it looks just like it should.

Next, I calculate phase as:

phase = atan(Q/I)

To check that this is right, I plot a*cos(phase).  It is equal to signal,
just like it should be.

The part that I'm getting confused on is interpreting the results of the
calculation of instantaneous frequency.
To derive a formula for instantaneous frequency, I took the derivative of
phase:

d/dx atan(Q/I) = (I*Q' - Q*I')/(I^2 + Q^2)

= [(sin + sin + sin) .* (-cos'-cos'-cos') - (-cos -cos -cos) .* (sin'
+sin' +sin')] / [(sin+sin+sin)^2 + (-cos-cos-cos)^2]

= [(sin + sin + sin) .* (sin + sin + sin) - (-cos -cos -cos) .* (cos +cos
+cos)] / [(sin+sin+sin)^2 + (cos+cos+cos)^2]

= [(sin + sin + sin)^2 + (cos +cos +cos)^2] / [(sin+sin+sin)^2 +
(cos+cos+cos)^2]

= 1

This result is puzzling to me because: Phase indicates that the
instantaneous frequency is constant for all of signal, but that the
instantaneous frequency of signal is certainly is not equal to 1.

Have I made an error?  Am I just missing the correct way to interpret the
instantaneous phase result?

Any help would be much appreciated
```
```On Feb 28, 10:44 pm, "maxplanck" <erik.bo...@comcast.net> wrote:
> OK, say I have the signal:
>
> signal=(sin(2*%pi*77.7811 .* x) + .39*sin(2*%pi*74.7811 .* x) +
> .34*sin(2*%pi*81.3811 .* x));
>
> From this I know: the real part of the signal is identical to the signal,
> and the imaginary part is:
>
> Q = (-cos(2*%pi*77.7811 .* x) - .39*cos(2*%pi*74.7811 .* x) -
> .34*cos(2*%pi*81.3811 .* x));
>
> Since the Hilbert transform of a sin(x) = -cos(x).
>
> Using this, I can find the amplitude envelope of signal by calculating:
>
> a = sqrt(I^2 + Q^2)
>
> This works perfectly, when I plot "a" it looks just like it should.
>
> Next, I calculate phase as:
>
> phase = atan(Q/I)
>
> To check that this is right, I plot a*cos(phase).  It is equal to signal,
> just like it should be.
>
> The part that I'm getting confused on is interpreting the results of the
> calculation of instantaneous frequency.
> To derive a formula for instantaneous frequency, I took the derivative of
> phase:
>
> d/dx atan(Q/I) = (I*Q' - Q*I')/(I^2 + Q^2)
>
> = [(sin + sin + sin) .* (-cos'-cos'-cos') - (-cos -cos -cos) .* (sin'
> +sin' +sin')] / [(sin+sin+sin)^2 + (-cos-cos-cos)^2]
>
> = [(sin + sin + sin) .* (sin + sin + sin) - (-cos -cos -cos) .* (cos +cos
> +cos)] / [(sin+sin+sin)^2 + (cos+cos+cos)^2]
>
> = [(sin + sin + sin)^2 + (cos +cos +cos)^2] / [(sin+sin+sin)^2 +
> (cos+cos+cos)^2]
>
> = 1
>
> This result is puzzling to me because: Phase indicates that the
> instantaneous frequency is constant for all of signal, but that the
> instantaneous frequency of signal is certainly is not equal to 1.
>
> Have I made an error?  Am I just missing the correct way to interpret the
> instantaneous phase result?
>
> Any help would be much appreciated

You do not have a 'simple signal' for determining a meaningful
definition of instantaneous phase or frequency.

Dale B. Dalrymple
http://dbdimages.com
```
```The instantaneous phase as calculated above is meaningful, since the
original signal can be generated using only the instantaneous amplitude
and phase information derived from that signal.

Whether the signal is simple or not is debatable i guess, but it's just
the sum of 3 sine waves..

>You do not have a 'simple signal' for determining a meaningful
>definition of instantaneous phase or frequency.
>
>Dale B. Dalrymple
>http://dbdimages.com
>
```
```On Feb 29, 7:44 pm, "maxplanck" <erik.bo...@comcast.net> wrote:
> OK, say I have the signal:
>
> signal=(sin(2*%pi*77.7811 .* x) + .39*sin(2*%pi*74.7811 .* x) +
> .34*sin(2*%pi*81.3811 .* x));
>
> From this I know: the real part of the signal is identical to the signal,
> and the imaginary part is:
>
> Q = (-cos(2*%pi*77.7811 .* x) - .39*cos(2*%pi*74.7811 .* x) -
> .34*cos(2*%pi*81.3811 .* x));
>
> Since the Hilbert transform of a sin(x) = -cos(x).
>
> Using this, I can find the amplitude envelope of signal by calculating:
>
> a = sqrt(I^2 + Q^2)
>
> This works perfectly, when I plot "a" it looks just like it should.
>
> Next, I calculate phase as:
>
> phase = atan(Q/I)
>
> To check that this is right, I plot a*cos(phase).  It is equal to signal,
> just like it should be.
>
> The part that I'm getting confused on is interpreting the results of the
> calculation of instantaneous frequency.
> To derive a formula for instantaneous frequency, I took the derivative of
> phase:
>
> d/dx atan(Q/I) = (I*Q' - Q*I')/(I^2 + Q^2)
>
> = [(sin + sin + sin) .* (-cos'-cos'-cos') - (-cos -cos -cos) .* (sin'
> +sin' +sin')] / [(sin+sin+sin)^2 + (-cos-cos-cos)^2]
>
> = [(sin + sin + sin) .* (sin + sin + sin) - (-cos -cos -cos) .* (cos +cos
> +cos)] / [(sin+sin+sin)^2 + (cos+cos+cos)^2]
>
> = [(sin + sin + sin)^2 + (cos +cos +cos)^2] / [(sin+sin+sin)^2 +
> (cos+cos+cos)^2]
>
> = 1
>
> This result is puzzling to me because: Phase indicates that the
> instantaneous frequency is constant for all of signal, but that the
> instantaneous frequency of signal is certainly is not equal to 1.
>
> Have I made an error?  Am I just missing the correct way to interpret the
> instantaneous phase result?
>
> Any help would be much appreciated

Easier to write the sum of the three in the form

A(t)cos(wt +phi(t))

and differentiate phi(t) wrt t.

It's all a bit academic though - are you looking at co-channel
interference?

Hardy
```
```"maxplanck" <erik.bowen@comcast.net> writes:

> d/dx atan(Q/I) = (I*Q' - Q*I')/(I^2 + Q^2)
>
> = [(sin + sin + sin) .* (-cos'-cos'-cos') - (-cos -cos -cos) .* (sin'
> +sin' +sin')] / [(sin+sin+sin)^2 + (-cos-cos-cos)^2]
>
> = [(sin + sin + sin) .* (sin + sin + sin) - (-cos -cos -cos) .* (cos +cos
> +cos)] / [(sin+sin+sin)^2 + (cos+cos+cos)^2]
>
> = [(sin + sin + sin)^2 + (cos +cos +cos)^2] / [(sin+sin+sin)^2 +
> (cos+cos+cos)^2]
>
> = 1

Are you taking into account the amplitude changes in the cos' and sin' terms?

d/dx sin (A .* x) = A.* cos( A .* x )

Ciao,

Peter K.

--
"And he sees the vision splendid
of the sunlit plains extended
And at night the wondrous glory of the everlasting stars."

```
```maxplanck wrote:
> OK, say I have the signal:
>
> signal=(sin(2*%pi*77.7811 .* x) + .39*sin(2*%pi*74.7811 .* x) +
> .34*sin(2*%pi*81.3811 .* x));
>
> From this I know: the real part of the signal is identical to the signal,
> and the imaginary part is:
>
> Q = (-cos(2*%pi*77.7811 .* x) - .39*cos(2*%pi*74.7811 .* x) -
> .34*cos(2*%pi*81.3811 .* x));

Whoa! Stop right there. If the imaginary part of a signal is not zero,
then the signal itself can't be equal to its real part. Conclusions
drawn from this falsehood are likely to be wrong as well.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```Jerry what do you make of this figure then?

http://www.studioprofessor.com/images/hilbert.jpg

This is from Lyons' "Understanding Digital Signal Processing".  He doesn't
make any caveats about xi(t) needing to be zero for the figure to be true,
and treating the signal like this does produce the amplitude envelope
perfectly.

Thanks for responding

>maxplanck wrote:
>> OK, say I have the signal:
>>
>> signal=(sin(2*%pi*77.7811 .* x) + .39*sin(2*%pi*74.7811 .* x) +
>> .34*sin(2*%pi*81.3811 .* x));
>>
>> From this I know: the real part of the signal is identical to the
signal,
>> and the imaginary part is:
>>
>> Q = (-cos(2*%pi*77.7811 .* x) - .39*cos(2*%pi*74.7811 .* x) -
>> .34*cos(2*%pi*81.3811 .* x));
>
>Whoa! Stop right there. If the imaginary part of a signal is not zero,
>then the signal itself can't be equal to its real part. Conclusions
>drawn from this falsehood are likely to be wrong as well.
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
>
```
```maxplanck wrote:
> Jerry what do you make of this figure then?
>
> http://www.studioprofessor.com/images/hilbert.jpg

At the left is a real (i.e. real-world, the kind one can measure)
signal. It's Fourier transform had both positive and negative frequencies.

At the right is a different signal, a complex signal that has two parts,
I and Q. *Remember: one signal, two parts.* Because of the way it has
been constructed, its Fourier transform has no negative frequencies, and
the amplitudes of the transform's positive frequencies are twice the
amplitudes of those of the first signal. It is called "analytic".

The instantaneous amplitude of the signal on the left is evaluated
directly. The instantaneous amplitude of the signal on the right is the
square root of I^2 + Q^2. They are clearly not the same.

If what you has in mind was that the real part of the analytic signal is
the same as the actual signal, then you were correct. What you do with
that is another question. Since your signal contains more than one
frequency, the concept of phase doesn't strictly apply to it.

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
```
```aha, what i'm trying to do is calculate the amplitude envelope, phase and
instantaneous frequency of the signal on the left (the real signal).

For this signal, I is simply the signal, and Q is the hilbert transform of
the signal, correct?  I think that this is correct because when I operate
under this assumption, the amplitude envelope and phase that I calculate
is correct (see image)

http://www.studioprofessor.com/images/plot.jpg

Can you elaborate on why the concept of phase does not apply to my signal?
It seems relevant to me, from looking at the above plot, and since the
signal

amplitude envelope * cos(phase)

is identical to the original, real signal.

>maxplanck wrote:
>> Jerry what do you make of this figure then?
>>
>> http://www.studioprofessor.com/images/hilbert.jpg
>
>At the left is a real (i.e. real-world, the kind one can measure)
>signal. It's Fourier transform had both positive and negative
frequencies.
>
>At the right is a different signal, a complex signal that has two parts,

>I and Q. *Remember: one signal, two parts.* Because of the way it has
>been constructed, its Fourier transform has no negative frequencies, and

>the amplitudes of the transform's positive frequencies are twice the
>amplitudes of those of the first signal. It is called "analytic".
>
>The instantaneous amplitude of the signal on the left is evaluated
>directly. The instantaneous amplitude of the signal on the right is the
>square root of I^2 + Q^2. They are clearly not the same.
>
>If what you has in mind was that the real part of the analytic signal is

>the same as the actual signal, then you were correct. What you do with
>that is another question. Since your signal contains more than one
>frequency, the concept of phase doesn't strictly apply to it.
>
>Jerry
>--
>Engineering is the art of making what you want from things you can get.
>&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
>
```
```ok, after rereading these posts i'm going to try to clarify.

What do you mean when you say that the instantaneous amplitude of the
signal on the left is evaluated directly?

Contrary (i think) to what you're saying, I'm able to calculate the
instantaneous amplitude of the signal on the left by generating its
complex representation (signal + j*hilbert(signal)) and then taking the
magnitude of this complex representation (sqrt(signal^2 +
hilbert(signal)^2)).

This is illustrated here, you can see that it works:
http://www.studioprofessor.com/images/plot.jpg

>aha, what i'm trying to do is calculate the amplitude envelope, phase
and
>instantaneous frequency of the signal on the left (the real signal).
>
>For this signal, I is simply the signal, and Q is the hilbert transform
of
>the signal, correct?  I think that this is correct because when I
operate
>under this assumption, the amplitude envelope and phase that I calculate
>is correct (see image)
>
>http://www.studioprofessor.com/images/plot.jpg
>
>
>Can you elaborate on why the concept of phase does not apply to my
signal?
> It seems relevant to me, from looking at the above plot, and since the
>signal
>
>amplitude envelope * cos(phase)
>
>is identical to the original, real signal.
>
>
>
>
>
>
>>maxplanck wrote:
>>> Jerry what do you make of this figure then?
>>>
>>> http://www.studioprofessor.com/images/hilbert.jpg
>>
>>At the left is a real (i.e. real-world, the kind one can measure)
>>signal. It's Fourier transform had both positive and negative
>frequencies.
>>
>>At the right is a different signal, a complex signal that has two
parts,
>
>>I and Q. *Remember: one signal, two parts.* Because of the way it has
>>been constructed, its Fourier transform has no negative frequencies,
and
>
>>the amplitudes of the transform's positive frequencies are twice the
>>amplitudes of those of the first signal. It is called "analytic".
>>
>>The instantaneous amplitude of the signal on the left is evaluated
>>directly. The instantaneous amplitude of the signal on the right is the

>>square root of I^2 + Q^2. They are clearly not the same.
>>
>>If what you has in mind was that the real part of the analytic signal
is
>
>>the same as the actual signal, then you were correct. What you do with
>>that is another question. Since your signal contains more than one
>>frequency, the concept of phase doesn't strictly apply to it.
>>
>>Jerry
>>--
>>Engineering is the art of making what you want from things you can get.
>>&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;&#65533;
>>
>
```