How to solve overdetermined vector equation?

Hi,
I have an equation like this:
sin(a1)*sin(a2)=v1, -cos(a1)*sin(a2)=v2, cos(a2)=v3
v1, v2 and v3 are components of a vector I know. How can I calculate the equation to get the results of a1 and a2?
Thanks!

Antworten (2)

Torsten
Torsten am 6 Jul. 2015

1 Stimme

Use lsqnonlin to minimize the function
F(a1,a2) = (sin(a1)*sin(a2)-v1)^2 + (cos(a1)*sin(a2)+v2)^2 + (cos(a2)-v3)^2
Best wishes
Torsten.
Bjorn Gustavsson
Bjorn Gustavsson am 6 Jul. 2015

0 Stimmen

Use pen and paper, draw the standard little sketch for spherical-and-Cartesian coordinates...
Then you get:
a2 = acos(v3);
% sin(a1)/cos(a1) = -v1/v2, so
a1 = atan2(v1,-v2); % check the order of the arguments to atan2
% perhaps this is a numerically better estimate of a2:
a2 = atan((v1^2+v2^2)^(1/2)/v3);
HTH

2 Kommentare

Torsten
Torsten am 6 Jul. 2015
I get
a2 = -atan((v1^2+v2^2)^(1/2)/v3);
Best wishes
Torsten.
Realy? Oh, well - no reason for us to get all agitated about sign conventions for rotational angles...
(I've seen 4 different definitions of azimuth used in astronomy! Clock-wise from North, counter-clock-wise from East, clock-wise from East, clock-wise from East)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange

Gefragt:

Max
am 6 Jul. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by