How can i change this code????
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
syms w phi k
eq1 = cos(phi)*cos(k)==-0.340110;
eq2 = -cos(phi)*sin(k)==0.999407;
eq3 = sin(phi)==0.004822;
eq4 = cos(w)*sin(k)+sin(w)*sin(phi)*cos(k)==-0.999419;
eq5 = cos(w)*cos(k)-sin(w)*sin(phi)*sin(k)==-0.034096;
eq6 = -sin(w)*cos(phi)==0.000621;
eq7 = sin(w)*sin(k)-cos(w)*sin(phi)*cos(k)==0.000784;
eq8 = sin(w)*cos(k)+cos(w)*sin(phi)*sin(k)==-0.004798;
eq9 = cos(w)*cos(phi)==0.999988;
[w phi k] = solve(eq1,eq2,eq3,eq4,eq5,eq6,eq7,eq8,eq9)
I want to get w, phi and k
What's wrong...?
1 commentaire
Ameer Hamza
le 23 Avr 2020
You have 9 equations and only three variables. This system of equation is overdetermined. The answer shows that their is nor solution which can make the nine equations true.
Réponses (1)
David Goodmanson
le 23 Avr 2020
0 votes
Hi KK,
yes, nine equations, three unknowns. However,
[1] from eqn3 you can find phi. There are two solutions for phi, one close to zero and the other slightly less than 180. For the first solution cos(phi) is positve and for the second solution cos(phi) is negative, Assume the first solution, which puts you in the first quadrant.
[2] From eqn1 and eqn2 you can calculate k using atan2. The solution will be in the third quadrant since both sin(k) and cos(k) are negative.
[3] From eqn6 and eqn9 you can calculate w using atan2. The solution will be in the fourth quadrant since sin(w) is negative and cos(w) is positive.
The four remaining equations can be used as consistency checks.
For the second solution, phi --> 180 - phi; cos(phi) --> -cos(phi) sin(phi) same
k --> k + 180 [or k - 180] cos(k) --> -cos(k) sin(k) --> -sin(k)
w --> w + 180 [or w - 180] cos(w) --> -cos(w) sin(w) --> -sin(w)
If sin(phi) stays positive and all the other trig functions change sign, then all nine equations are unaffected as you can check.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!