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?

Antworten (2)

Roger Stafford
Roger Stafford am 23 Mai 2016
Bearbeitet: Roger Stafford am 23 Mai 2016

0 Stimmen

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 Kommentare

Katrine Rav
Katrine Rav am 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?
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.

Melden Sie sich an, um zu kommentieren.

Katrine Rav
Katrine Rav am 24 Mai 2016

0 Stimmen

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?

Kategorien

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

Gefragt:

am 23 Mai 2016

Beantwortet:

am 24 Mai 2016

Community Treasure Hunt

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

Start Hunting!

Translated by