Calculating jacobian while using symbolic toolbox

조회 수: 1 (최근 30일)
Jakob Vinkås
Jakob Vinkås 2019년 9월 20일
댓글: Walter Roberson 2019년 9월 20일
Hello! I can't seem to find the answer to my problem so I figured that I'd ask it myself.
I am trying to calculate the jacobian based on symbolic variables as follows:
syms x(t) y(t) z(t) theta(t) phi(t) L
q = [x, y, z, theta, phi].';
dq = diff(q,t);
p1 = [x, y, z].';
dp1 = diff(p1, t);
p2 = [x + L*cos(theta),
y + L*cos(phi),
z + L*sin(theta) + L*sin(phi)];
dp2 = jacobian(p2, q)*dq;
I want to use it to module a system using Lagrange modelling.
The error message comes as follow:
Error using sym/jacobian (line 44)
Second argument must be a vector of variables.
Error in untitled (line 15)
dp2 = jacobian(p2, q)*dq;
Thanks in advance, Jakob
  댓글 수: 5
Bjorn Gustavsson
Bjorn Gustavsson 2019년 9월 20일
Also: are you sure about the expression for p2? It seems suspicious to me.
Walter Roberson
Walter Roberson 2019년 9월 20일
In particular if you are working with polar coordinates then you would normally multiply two trig components rather than add them.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by