# calculate magnitude and phase

This topic is 3162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I'm stuck with a problem for a few days, it's for structural engineering project. Say there is a point on an xy plane at zero. if the point oscillates in the x direction with a magnitude of 6 and a phase of 25 degrees, and also oscillates in the y direction with a magnitude of 8 and phase of 90 degrees, how do I find the maximum extension from zero that the point will make? and at what phase will that occur? I first thought it would be simple addition of complex numbers, but that doesn't seem to work. Any ideas? Best regards Albert

##### Share on other sites
Quote:
 Original post by acp693... if the point oscillates in the x direction with a magnitude of 6 and a phase of 25 degrees, and also oscillates in the y direction with a magnitude of 8 and phase of 90 degrees...
Does this mean that the point is given as a vector of 2 sine functions with the same frequency but different phases (and amplitudes, of course)?

##### Share on other sites
Hi, Yes that's right.

##### Share on other sites
Quote:
 how do I find the maximum extension from zero that the point will make? and at what phase will that occur? I first thought it would be simple addition of complex numbers, but that doesn't seem to work.

It should work. Maybe you're getting the sign on the phase wrong? Think about it with phasors, or equivalently remember the trig identity,

M cos(omega t - phi) = A cos(omega t) + B sin(omega t)

where

A = M cos(phi)
B = M sin(phi) .

Notice that the relationship between (M, phi) and (A,B) is precisely the relationship between polar and cartesian coordinates.

##### Share on other sites
Thanks, That's what I first thought, however consider the simpler case of
x direction vector= Magnitude 6, phase 0 degrees, (6+0i)
y direction vector= magnitude 6, phase 90 degrees,(0+6i)

the point should then describe a circle of radius 6?

However addition of the complex numbers 6+0i + 0+6i = 6+6i.

magnitude = |6+6i| = 8.4853 ?

That would be the correct answer if x and y had the same phase.

I don't know where I'm going wrong with this.

Best regards

Albert

##### Share on other sites
Quote:
 Original post by acp693Thanks, That's what I first thought, however consider the simpler case of x direction vector= Magnitude 6, phase 0 degrees, (6+0i) y direction vector= magnitude 6, phase 90 degrees,(0+6i)the point should then describe a circle of radius 6? However addition of the complex numbers 6+0i + 0+6i = 6+6i.magnitude = |6+6i| = 8.4853 ?
AFAIS, you're dropping the time dependency here with the result that the vector you construct for the addition has x and y components at different times.

The correct vector would be
v(t) := [ 6 * sin( wt ), 6 * sin( wt + pi/2 ) ]t = [ 6 * sin( wt ), 6 * cos( wt ) ]t
with an expected magnitude of
|v(t)| = sqrt( 36 * sin2( wt ) + 36 * cos2( wt ) ) = 6

Now, the complex number you have used are results e.g. at
v( t=0 ) = [ 0, 6 ]t
and
v( t=pi/(2w) ) = [ 6, 0 ]t
where obviously 2 different times are used. Hence is is not correct to add them up.

EDIT: Uhh, I recently saw that I've exchanged the phases in comparison to your original example. But the reasoning is still the same, though.

##### Share on other sites
Thank you Haegarr for your help. I'm still stuck with this, although your example seems to work for the simple example, I can't get it to work with my original example?

I have drawn on graph paper the expected path of the point of the original example using 5 degrees as increments. The maximum magnitude would seem to be 8.64

How do I determine what t would be at maximum magnitude?

Best regards

Albert

##### Share on other sites
OMG, you need a bag full of ugly math! The following is a correct mathematical way AFAIK, but I'm not a mathematician, so be warned. Hence I invite people to check that solution, of course.

The vector is defined as
v(t) := [ Ax sin( ωt + φx ), Ay sin( ωt + φy ) ]T
and its length is
|v(t)| = sqrt( Ax2 sin2( ωt + φx ) + Ay2 sin2( ωt + φy ) )

There is a correspondence in trigonometry that says
sin2( α ) = ( 1 - cos( 2α ) ) / 2

So we get
|v(t)| = sqrt( Ax2 + Ay2 - Ax2 cos( 2ωt + 2φx ) - Ay2 cos( 2ωt + 2φy ) ) / sqrt( 2 )
=: sqrt( p(t) ) / sqrt( 2 )

To get the t where |v(t)| is maximum, the usual way is to compute the derivative, set it to 0, resolve for t, and check whether the function has the correct sign reversal. Now, if |v(t)| is maximal, then also p(t) must be maximal (AFAIK), so we actually compute
d p(t) / dt = 0
what makes things easier.

So we get
d p(t) / dt = Ax2 2ω sin( 2ωt + 2φx ) + Ay2 2ω sin( 2ωt + 2φy )

Setting this to 0 and resolving for t ... is not in my power! But there is the superposition principle of harmonics to our rescue! It says that
A1 sin( ωt + φ1 ) + A2 sin( ωt + φ2 ) == A sin( ωt + φ )
where
A = ... (not of particular interest here)
tan( φ ) = ( A1 sin( φ1 ) + A2 sin( φ2 ) ) / ( A1 cos( φ1 ) + A2 cos( φ2 ) )

With the substitutions
A1 := Ax2
A2 := Ay2
φ1 := 2φx
φ2 := 2φy
ω := 2ω
we can compute the φ.

Now, the formula (using the original ω)
A sin( 2ωt + φ ) == 0
means that
2ωt + φ == n π (( err, that writing is "en by pi"))
where n is a natural number. Hence it is possible to compute a t, verify it, set it into the original formula of |v(t)| and yield in the maximum magnitude.

BTW: I will damn everybody who provides an easier solution after this post ;) There was so much time from the beginning of this thread up to now...

##### Share on other sites
Wow, thank you very much Haegarr, It will take me a while to look through this,
Actually, my problem is really in 3 dimensions and not 2 as in my example, I just thought it would be easier to try and find out how to do it in 2 dimensions first.

Thanks again

Albert

##### Share on other sites
Quote:
 Original post by acp693Actually, my problem is really in 3 dimensions and not 2 as in my example, I just thought it would be easier to try and find out how to do it in 2 dimensions first.
If the way shown above works well, then its extension to 3 dimensions is not a problem: The derivation works the same for 3 dimensions, and the superposition principle can be extended to any dimensions (according to my Bronstein, just for the case you know it ;)

1. 1
Rutin
47
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632993
• Total Posts
3009757
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!