How do I solve a matrix for it's variables?

I defined this matrix
function [euler]=eu(z,y,x)
[euler]=[cosd(z)*cosd(y) cosd(z)*sind(y)*sind(x)-sind(z)*cosd(x) cosd(z)*sind(y)*cosd(x)+sind(z)*sind(x); sind(z)*cosd(y) sind(z)*sind(y)*sind(x)+cosd(z)*cosd(x) sind(z)*sind(y)*cosd(x)-cosd(z)*sind(x); -sind(y) cosd(y)*sind(x) cosd(y)*cos(x)]
end
I wish to calculate z, y, x when euler=[0,0,-1;0,-1,0;-1,0,0].
I tried
>> solve(eu(z,y,x)==[0,0,-1;0,-1,0;-1,0,0])
What command should I use?

Réponses (2)

Roger Stafford
Roger Stafford le 23 Mai 2016
Modifié(e) : Roger Stafford le 23 Mai 2016
You cannot determine x, y, and z uniquely from your given value of 'euler'. For this value they all reduce to three simple equalities:
cosd(x-z) = -1
sind(x-z) = 0
sind(y) = 1
from which you can only conclude that y is equal to 90 plus or minus some multiple of 360, and that x and z differ by 180 plus or minus some multiple of 360.

2 commentaires

Katrine Rav
Katrine Rav le 24 Mai 2016
Allright, bad example. What if I want to solve another value of euler, where euler is a 3x3 matrix? How would I write that?
Walter Roberson
Walter Roberson le 24 Mai 2016
9 nonlinear equations in 3 unknowns seldom has a solution, especially since you are using floating point arithmetic to define the values.
But more of a problem is that you are trying to find the unique Euler angles that will bring about a particular 3D rotation. There are always at least two sets of angles that bring about the same 3D rotation.

Connectez-vous pour commenter.

Katrine Rav
Katrine Rav le 24 Mai 2016

0 votes

I know it's not guaranteed that it will work. But what do I write to check if it works?
The rotationmatrix [0.447314,-0.358681,0.852032;0.447214,0.879974,0.179045;-0.774597,0.300969,0.491919] should generate the angles x=-20, y=60 and z=45.
How do I test that?

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by