rewrite A=[3*1] matrix to [3*3]*[3*1(var)]=A

1 次查看(过去 30 天)
dear all
i have 3*1 matrix like matrix E below
syms qd td ed q teta
E =[ ed*cos(q)*sin(teta) - cos(teta)*(qd*cos(q)*sin(teta) + td*cos(teta)*sin(q)) - td*sin(q)*sin(teta)^2 ; cos(teta)*(td*cos(teta)*sin(q) - qd*sin(q)*sin(teta)) + ed*sin(q)*sin(teta) + td*cos(q)*sin(teta)^2 ; ed*cos(teta) + cos(q)*sin(teta)*(qd*cos(q)*sin(teta) + td*cos(teta)*sin(q)) - sin(q)*sin(teta)*(td*cos(teta)*sin(q) - qd*sin(q)*sin(teta))]
that i want to rewrite it in [3*3]*[qd;td;ed]=[E] this form
is there any Command that can help me to calculate this [3*3] matrix by matlab
answer should be like this:
[ -cos(q)*cos(teta)*sin(teta), - cos(teta)^2*sin(q) - sin(q)*sin(teta)^2, cos(q)*sin(teta)]
[ -cos(teta)*sin(q)*sin(teta), sin(q)*cos(teta)^2 + cos(q)*sin(teta)^2, sin(q)*sin(teta)]
[ cos(q)^2*sin(teta)^2 + sin(q)^2*sin(teta)^2, cos(q)*cos(teta)*sin(q)*sin(teta) - cos(teta)*sin(q)^2*sin(teta), cos(teta)]
i really apreciated if you could help me

采纳的回答

Star Strider
Star Strider 2017-12-9
Doing it by matrix division (the mldivide function) did not work because the rows are not consistent.
The only solution I can come up with is:
syms qd td ed q teta
E =[ ed*cos(q)*sin(teta) - cos(teta)*(qd*cos(q)*sin(teta) + td*cos(teta)*sin(q)) - td*sin(q)*sin(teta)^2 ; cos(teta)*(td*cos(teta)*sin(q) - qd*sin(q)*sin(teta)) + ed*sin(q)*sin(teta) + td*cos(q)*sin(teta)^2 ; ed*cos(teta) + cos(q)*sin(teta)*(qd*cos(q)*sin(teta) + td*cos(teta)*sin(q)) - sin(q)*sin(teta)*(td*cos(teta)*sin(q) - qd*sin(q)*sin(teta))];
v = [qd;td;ed];
for k1 = 1:size(E,1)
C{k1} = coeffs(E(k1), v);
end
Out = [C{1}; C{2}; C{3}]
The columns of ‘Out’ are with respect to the elements of ‘v’, in order. Change the order of ‘v’ to produce the result you want.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Numbers and Precision 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by