Why is the derivative of a matrix not of the same order?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Farzad Torabi
le 15 Nov 2022
Réponse apportée : Walter Roberson
le 17 Nov 2022
Hi
I need to take the derivative of the "Q" matrix of joints in Matlab for a robot. but using the derivative method here
I see that the derivative of a 3x3 matrix is a 2x3 matrix! why? should it be so?
4 commentaires
Réponse acceptée
Plus de réponses (2)
Walter Roberson
le 17 Nov 2022
For the case where rotations are no rotations in z, but there are two joints moving around
and
with angular rotational velocities
and
:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1195993/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1195998/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1196003/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1196008/image.png)
syms x y z t alpha_1 alpha_2 cx_1 cy_1 cz_1 cx_2 cy_2 cz_2 theta theta_1 theta_2
R = @(theta) [cos(theta) sin(theta) 0 0; -sin(theta) cos(theta) 0 0; 0 0 1 0; 0 0 0 1]
T = @(tx, ty, tz) [1 0 0 tx; 0 1 0 ty; 0 0 1 tz; 0 0 0 1]
RotAround = @(theta, cx, cy, cz) T(-cx, -cy, -cz) * R(theta) * T(cx, cy, cz)
Q1 = RotAround(theta_1 + alpha_1 * t, cx_1, cy_1, cz_1)
Q2 = RotAround(theta_2 + alpha_2 * t, cx_2, cy_2, cz_2)
Q = simplify(Q1 * Q2)
eqns = Q*[x;y;z;0]
dx = simplify(diff(eqns(1), t))
dy = simplify(diff(eqns(2), t))
dz = simplify(diff(eqns(3), t))
You could extend this to include rotations in Z or to include additional joints.
0 commentaires
Bruno Luong
le 15 Nov 2022
Modifié(e) : Bruno Luong
le 15 Nov 2022
I guess you mistaken between
- numerical finite difference https://fr.mathworks.com/help/matlab/ref/diff.html
- and symbolic derivative https://fr.mathworks.com/help/symbolic/diff.html
Use the fist is just the difference of 3 rows of Q 3x3 matrix, there fore returns 2x3 matrix. It is NOT the derivative/
4 commentaires
Bruno Luong
le 15 Nov 2022
Nah, instead of taking the derivative wrt the robot joint (where the matrix depends on), he takes the difference of rows. Completely wrong methodology.
The discrepency is in the wrong computation methodology, nothing to do with accuracy of numerical method or step size.
Voir également
Catégories
En savoir plus sur Multibody Modeling dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!