How do I solve a matrix for it's variables?
25 views (last 30 days)
Show older comments
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?
0 Comments
Answers (2)
Roger Stafford
on 23 May 2016
Edited: Roger Stafford
on 23 May 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 Comments
Walter Roberson
on 24 May 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.
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!