33 views (last 30 days)

David Goodmanson
on 2 Apr 2020

Edited: David Goodmanson
on 2 Apr 2020

Hi Berke,

I wrote a clarification to your previous question which I think should resolve that issue. It looks like you have determined (or can determine) a, c and phi and wish to solve for b and theta. The first equation in your question is just the imaginary part of

a*exp(i*x) + b*exp(i*x + i*theta) = c*exp(i*x + i*phi)

Factoring out the exp(i*x) leaves

a + b*exp(i*theta) = c*exp(i*phi)

so the sum of two phasors is a third one. [ note that multiplying this equation by its complex counjugate gives the second equation in the question ]. Solving this gives

b = abs(c*exp(i*phi) - a)

theta = angle(c*exp(i*phi) - a)

Just like acos, angle has a convention that deals with 2pi ambiguity, which is -pi < angle <=pi. This means that for the case that you mentioned, angle will produce -120 degrees, not 240. That's how it is, but if you want only positive angles, then (for degrees) it would be mod(angle,360).

Guillaume
on 1 Apr 2020

"Is it possible to make Acos return values greater than pi?"

No. The function codomain is mathematically defined as [0, π]. You can define your own reciprocal of the cosinus function with a different codomain but that won't be arccos.eg:

function y = myaccosd(x)

y = -accosd(x);

end

which would return your 240 degrees (mod 360) for an input of -0.5.

Walter Roberson
on 1 Apr 2020

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 6 Comments

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819217

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819217

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819232

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819232

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819248

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819248

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819263

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819263

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819279

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819279

## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819615

⋮## Direct link to this comment

https://se.mathworks.com/matlabcentral/answers/514570-is-it-possible-to-make-acos-return-values-greater-than-pi#comment_819615

Sign in to comment.