Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
shahin hashemi
shahin hashemi am 9 Dez. 2017
Kommentiert: Star Strider am 9 Dez. 2017
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

Akzeptierte Antwort

Star Strider
Star Strider am 9 Dez. 2017
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.
  2 Kommentare
shahin hashemi
shahin hashemi am 9 Dez. 2017
thanks alot with best wishes
Star Strider
Star Strider am 9 Dez. 2017
As always, my pleasure!
Best wishes to you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by