Finding the tan inverse for different range of values
조회 수: 4 (최근 30일)
이전 댓글 표시
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
답변 (2개)
David Goodmanson
2017년 5월 6일
편집: David Goodmanson
2017년 5월 6일
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
Star Strider
2017년 5월 6일
‘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
Star Strider
2017년 5월 9일
‘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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!