# Calculating instantaneous phase of a simple signal

Started by February 29, 2008
```On Mar 1, 11:16 am, "maxplanck" <erik.bo...@comcast.net> wrote:

> Thanks for clarifying Dale.
>
> I started searching through the IEEE database, and there are many articles
> on instantaneous frequency calculation from the 90's.

In the Letters on Signal Processing there are 10. Two of them have
'multcomponent' in the title. Try them first.

Dale B. Dalrymple
```
```On Mar 1, 12:15 pm, "maxplanck" <erik.bo...@comcast.net> wrote:

> I have a signal composed of three sine waves added together, each sine wave
> having constant frequency and amplitude.  Each sine wave's frequency and
> amplitude is different from that of the other two.
>
> I want to reproduce this signal using only ONE sine oscillator, of
> variable amplitude and constant frequency.  I know that the desired signal
> reproduction can be accomplished using only one sine wave of constant
> frequency, because it can be derived that for a successful signal
> reproduction using only one sine wave the frequency of this lone sine wave
> MUST be constant.

Calulate the phase that you define in your plot file. Use phase
differences to calculate the frequency of your combined signal. It is
not constant, so no single frequency oscillator will generate your
signal.

> What Dale said confirmed this as well.

What I confirmed is that no reasonable instantaneous frequency will
recreate your signal in the manner you wish. Your signal is not simple
enough to have that meaningful an instantaneous frequency.

>
> I have already calculated the amplitude envelope that would need to be
> applied to the lone sine wave.  Now all I need to do is calculate the
> frequency that this lone sine wave would have to oscillate at in order for
> it to equal the original "three summed sine wave" signal.

Use the phase increments I suggested you calculate to modulate the
frequency of your oscillator as well as the amplitude to reconstruct

>
> Thanks for responding
>

Dale B. Dalrymple

```
```OK, thanks for setting me straight here.

I was hoping to avoid using these numerical methods because of the small
error inherent in them, but since you're suggesting them I'm assuming that
they're the best solution available.  Right?

The IEEE Letters don't suggest a more exact method, right?

>> I have a signal composed of three sine waves added together, each sine
wave
>> having constant frequency and amplitude.  Each sine wave's frequency
and
>> amplitude is different from that of the other two.
>>
>> I want to reproduce this signal using only ONE sine oscillator, of
>> variable amplitude and constant frequency.  I know that the desired
signal
>> reproduction can be accomplished using only one sine wave of constant
>> frequency, because it can be derived that for a successful signal
>> reproduction using only one sine wave the frequency of this lone sine
wave
>> MUST be constant.
>
>Calulate the phase that you define in your plot file. Use phase
>differences to calculate the frequency of your combined signal. It is
>not constant, so no single frequency oscillator will generate your
>signal.
>
>> What Dale said confirmed this as well.
>
>What I confirmed is that no reasonable instantaneous frequency will
>recreate your signal in the manner you wish. Your signal is not simple
>enough to have that meaningful an instantaneous frequency.
>
>>
>> I have already calculated the amplitude envelope that would need to be
>> applied to the lone sine wave.  Now all I need to do is calculate the
>> frequency that this lone sine wave would have to oscillate at in order
for
>> it to equal the original "three summed sine wave" signal.
>
>Use the phase increments I suggested you calculate to modulate the
>frequency of your oscillator as well as the amplitude to reconstruct
>
>>
>> Thanks for responding
>>
>
>Dale B. Dalrymple
>
>
```
```On Mar 1, 3:06 pm, "maxplanck" <erik.bo...@comcast.net> wrote:

> OK, thanks for setting me straight here.
>
> I was hoping to avoid using these numerical methods because of the small
> error inherent in them, but since you're suggesting them I'm assuming that
> they're the best solution available.  Right?
>
> The IEEE Letters don't suggest a more exact method, right?
>

Since you have given us no requirements information, specifications or
goals to use as a basis, the term 'best' can't be evaluated.

You might generate your signal by scaling and summing three
oscillators. The topic of such sinusoidal generators and their
characteristics has been discussed frequently in this group.

Dale B. Dalrymple
```
```I just want my one oscillator reproduction to match the original 3
oscillator signal, sample for sample, as close as possible.  The closer I
can get, the better, and computational expensiveness is not an issue (it
can be as expensive as it needs to be to produce the closest match
possible).

My whole point in doing this is to reproduce the three oscillator signal
using only one oscillator.  To use more than one oscillator in the
reproduction would defeat the purpose.  I've refrained from explaining the
purpose beyond this because it will just make the discussion more
confusing.  But if you want me to try to explain, let me know and i'll
try.

In the interest of simplicity, my entire goal can be succinctly stated
as:

I have a signal composed of three sine waves added together, each sine
wave
having constant frequency and amplitude. Each sine wave's frequency and
amplitude is different from that of the other two.

I want to reproduce this signal using only ONE sine oscillator, of
variable amplitude and frequency.

The single oscillator reproduction should match the original 3 oscillator
signal, sample for sample, as close as possible.  The closer I can get,
the better, and computational expensiveness is not an issue (it can be as
expensive as it needs to be to produce the closest match possible).

>Since you have given us no requirements information, specifications or
>goals to use as a basis, the term 'best' can't be evaluated.
>
>You might generate your signal by scaling and summing three
>oscillators. The topic of such sinusoidal generators and their
>characteristics has been discussed frequently in this group.
>
>Dale B. Dalrymple
>
```
```maxplanck wrote:

...

> In the interest of simplicity, my entire goal can be succinctly stated
> as:
>
> I have a signal composed of three sine waves added together, each sine
> wave
> having constant frequency and amplitude. Each sine wave's frequency and
> amplitude is different from that of the other two.
>
> I want to reproduce this signal using only ONE sine oscillator, of
> variable amplitude and frequency.
>
> The single oscillator reproduction should match the original 3 oscillator
> signal, sample for sample, as close as possible.  The closer I can get,
> the better, and computational expensiveness is not an issue (it can be as
> expensive as it needs to be to produce the closest match possible).

Out of curiosity, why do you want to do this?

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;
```
```The 3 oscillator signal sounds interesting to the ears when played through
a speaker.  I want to understand it in terms that the brain/ears can most
easily understand, which I think are for this signal: frequency and
amplitude of a single sine oscillator.

I think this because the signal is of a very small bandwidth, and the
generation method involves only sine waves (no noise).  This type of
signal will probably lend itself to representation through a single sine
oscillator nicely.

If I can reproduce this signal using one sine oscillator with frequency
and amplitude each controlled by a 2-d plot, then I can better understand
why the sound is interesting to the ears.  Then, the best part, is that
representation of the sound in this way is easily manipulable in terms
that the brain/ears instinctively understand (frequency and amplitude.)

>Out of curiosity, why do you want to do this?
>
>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;
>
```
```Incidentally, here's an idea that I had that that may or may not be useful,

I know that

signal = A*sin(2*pi*f*t)

Where f is the instantaneous frequency of the signal and A is the
amplitude envelope of the signal.

At first glance, I thought that I could then simply say:

signal/A = sin(2*pi*f*t)

then

asin(signal/A) = 2*pi*f*t

and then

1/(2*pi*t) * asin(signal/A) = f

But when I plot f, it does not match my numerically calculated
instantaneous frequency (which was calculated by taking diff(phase) in
scilab, i.e. calculating the slope of the tangent line between each of

I think that this must have something to do with the fact that
asin(sin(x)) does not equal x if x > pi/2.

Does this ring any bells?  Any idea how to get past this, to calculate the
instantaneous frequency f?

Thanks a lot for continuing to respond guys
```
```"maxplanck" <erik.bowen@comcast.net> wrote in message

>
> I know that
>
> signal = A*sin(2*pi*f*t)
>
> Where f is the instantaneous frequency of the signal and A is
> the
> amplitude envelope of the signal.
>
> At first glance, I thought that I could then simply say:
>
> signal/A = sin(2*pi*f*t)
>
> then
>
> asin(signal/A) = 2*pi*f*t
>
> and then
>
> 1/(2*pi*t) * asin(signal/A) = f

It's Sunday morning and my Aspirin hasn't kicked in yet but:

-pi/2 <= 2*pi*f*t <= pi/2,

-1/(4*f) <= t <= 1/(4*f),

0 <= t + 1/(4*f) <= 1/(2*f),

so replace t with T where:

T = {[t + 1/(4*f)] modulo [1/(2*f)]} - 1/(4*t).

For example:

T = 0;

while (1)
{
signal = getSignal();
f = 1/(2*pi*T)) * asin(signal/A);
T = T + dT;

while(T > (1/(2*f))) T -= 1/(2*f);
}

Note: I really don't see this going anywhere for a general,
composite "signal" with a time-varying A.  It seems to me that
the math is only valid where "signal" is a pure sine with a
known, fixed A, so I wonder what the real-world application
might be.

```
```On Sat, 01 Mar 2008 14:15:41 -0600, maxplanck <erik.bowen@comcast.net> wrote:
>I have a signal composed of three sine waves added together, each
>sine wave having constant frequency and amplitude.  Each sine wave's
>frequency and amplitude is different from that of the other two.

I had better admit up front that I'm not a DSP expert; I just spend
a lot of time listening and learning here.

It sounds like you start with a signal S you assume to be composed
of three individual scaled-and-perhaps-phase-shifted pure sine waves
of frequencies f1, f2, and f3:

S(t) = (k1 + sin(t * (2*%pi)/f1))
+ (k2 + sin(t * (2*%pi)/f2))
+ (k3 + sin(t * (2*%pi)/f3))

Since you don't specify any relationship between f1, f2, and f3,
I'll assume there may not be / isn't one.

>I want to reproduce this signal using only ONE sine oscillator, of
>variable amplitude and constant frequency.  I know that the desired
>signal reproduction can be accomplished using only one sine wave of
>constant frequency, because it can be derived that for a successful
>signal reproduction using only one sine wave the frequency of this
>lone sine wave MUST be constant.  What Dale said confirmed this as
>well.
>
>I have already calculated the amplitude envelope that would need to
>be applied to the lone sine wave.  Now all I need to do is calculate
>the frequency that this lone sine wave would have to oscillate at in
>order for it to equal the original "three summed sine wave" signal.

Every time I read this it "feels" like a GCM/LCD (Greatest Common
Multiple / Least Common Denominator) question.  This may be
relevant; it may also indicate I've misunderstood something
(wouldn't be the first time <grin!>).

Based on this construction of S(t), S(t) will be periodic over the
perhaps-very-long period 1/(f1*f2*f3).  If you calculate and store
the envelope of S over that (fixed length) period, you could use an
as a time base to "clock" an infinite number of repetitions of the
envelope.  Ugly <grin!>, but it seems to satisfy the stated
objective.

Or (and equally ugly <grin!>), I _think_ you could take that
envelope and mathematically calculate a different (fixed length)
"envelope" over the same perhaps-very-long period which could be
multiplied by the "oscillator" frequency f1*f2*f3 to recreate S(t).

Of course, if you can find a least-common-multiple for f1*f2*f3,
then you can reduce the period you're concerened with.

It'a also possible that you're attempting to find a GCD for f1, f2,
and f3 and set up (integral) multipliers so you can generate:

f1 = k1*GCD(f1,f2,f3)
f2 = k2*GCD(f1,f2,f3)
f3 = k3*GCD(f1,f2,f3)

If so, be careful:  the GCD may be 1, and the k-s could wind up
being large.

Does this help at all?

Frank McKenney
--
If you find a path with no obstacles, it probably doesn't