trasformation of a unit vector quiver3

2 Ansichten (letzte 30 Tage)
Andrea Gusmara
Andrea Gusmara am 4 Mai 2020
Kommentiert: Ameer Hamza am 4 Mai 2020
Hi everyone , i would like to know if it is possibile to obtain a trasformation of quiver3 object . I have a normal quiver3 object and i want to trasform with my homogenous traformation matrix hM(4*4). i don't want modify my q_w but get another one. thank you very much.
q_w=quiver3(zeros(3,1),zeros(3,1),zeros(3,1),[1;0;0],[0;1;0],[0;0;1]);
q_w.LineWidth=3;
q_w.AutoScaleFactor=8;
rz=[ cos(psi) -sin(psi) 0 ;
sin(psi) cos(psi) 0 ;
0 0 1] ;
ry=[ cos(theta) 0 sin(theta) ;
0 1 0 ;
-sin(theta) 0 cos(theta)];
rx=[ 1 0 0 ;
0 cos(fi) -sin(fi);
0 sin(fi) cos(fi)];
rM=ry*rx*rz; % giusta
% rMf=matlabFunction(rM);
%creaiamo la nostra matrice omogenea
transition=[x y z]';
% transitionF=matlabFunction(transition);
one=ones(1);
hM= [ rM transition ;
zeros one ];

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 4 Mai 2020
Bearbeitet: Ameer Hamza am 4 Mai 2020
Try this
vec1 = [1;0;0];
vec2 = [0;1;0];
vec3 = [0;0;1];
q_w=quiver3(zeros(3,1),zeros(3,1),zeros(3,1),vec1,vec2,vec3);
q_w.LineWidth=3;
q_w.AutoScaleFactor=8;
psi = pi/4;
theta = pi/3;
fi = pi/6;
rz=[ cos(psi) -sin(psi) 0 ;
sin(psi) cos(psi) 0 ;
0 0 1] ;
ry=[ cos(theta) 0 sin(theta) ;
0 1 0 ;
-sin(theta) 0 cos(theta)];
rx=[ 1 0 0 ;
0 cos(fi) -sin(fi);
0 sin(fi) cos(fi)];
rM=ry*rx*rz; % giusta
figure;
q_w=quiver3(zeros(3,1),zeros(3,1),zeros(3,1),rM*vec1,rM*vec2,rM*vec3);
q_w.LineWidth=3;
q_w.AutoScaleFactor=8;
Also see eul2rotm(): https://www.mathworks.com/help/releases/R2020a/robotics/ref/eul2rotm.html to generate the rotation matrix.
  12 Kommentare
Andrea Gusmara
Andrea Gusmara am 4 Mai 2020
you are right , the problem was the variable zeros , thank you so much
for your patience and attention.
Ameer Hamza
Ameer Hamza am 4 Mai 2020
I am glad to be of help.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by