Finding the tan inverse for different range of values
7 views (last 30 days)
Show older comments
I have two quantities phi1 and phi2 that are obtained from the phase of complex quantities. Being phase their values lies from -pi to +pi. I define the following quantities:
alpha=phi1-phi2;
S1=cos(alpha);
S2=sin(alpha);
K=atan2(S2,S1);
I need K to be same as alpha. But since atan2 returns values from -pi to pi, there is a difference of 2pi in some of the elements. Subtracting phi1 and phi2 to get alpha has changed its range to 2pi to -2pi.
I want exact alpha value, because there is another equation giving
beta=phi1+phi2.
And my main aim is to evaluate phi1 by deriving alpha from S1 and S2 and the beta equation (i.e two simultaneous equations). Can anyone please help me evaluate the original values of alpha?|
0 Comments
Answers (2)
David Goodmanson
on 6 May 2017
Edited: David Goodmanson
on 6 May 2017
Hello AK, consider the following two situations, where all phi obey -pi<angle<pi :
case x
phi1x = pi - pi/20
phi2x = -pi + pi/20
alphax = 2pi - pi/10
case y
phi1y = - pi/20
phi2y = + pi/20
alphay = - pi/10
Now sin(alphax)=sin(alphay), cos(alphax)=cos(alphay) and taking trig functions removes the 2pi difference between alphax and alphay. You need that 2pi-or-not information to find phi1 and phi2, and there is no way to get it back. And beta = 0 in both cases. So it does not look good for this method.
0 Comments
Star Strider
on 6 May 2017
‘Subtracting phi1 and phi2 to get alpha has changed its range to 2pi to -2pi.’
Exactly.
Is there a particular reason for calculating ‘K’? (In phasor notation, subtract the phase values to divide one phasor by another, and add them to multiply.) Calculating ‘K’ puts them in the correct quadrant on the interval (-pi,pi). Taking the cos and sin of ‘K’ reproduces ‘S1’ and ‘S2’.
‘I need K to be same as alpha.’
The only way you are going to achieve that is:
K = alpha;
2 Comments
Star Strider
on 9 May 2017
‘Can there be any method to evaluate the phase in this (-2pi,2pi) range instead of reducing them to pi to -pi range.’
Not to my knowledge.
You can convert them to the interval (0,2*pi) with this utility function:
Angles2pi = @(a) rem(2*pi+a, 2*pi); % For ‘atan2’
The ‘a’ argument is the angle in radians on the interval (-pi,pi). That is likely the best you can do.
See Also
Categories
Find more on Performance and Memory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!