필터 지우기
필터 지우기

How to define a symbolic function q such that diff(q, t) gives me q_dot

조회 수: 5 (최근 30일)
Japnit Sethi
Japnit Sethi 2020년 3월 23일
댓글: Walter Roberson 2020년 3월 23일
So I want to define a symbolic variable q that is a function of t
and want the script to give me
I do not know what the function q is !! I just know that q is a function of t and I want to symbolically output qdot for differentation of q w.r.t t
% My approach that did not work
% Define the number of degrees of freedom
n_dof = 2;
syms t
% Define the generalized coordinates and their derivatives
q = sym('q',[n_dof,1],'real');
q_dot = sym('q_dot',[n_dof,1],'real');
q_ddot = sym('q_ddot',[n_dof,1],'real');
diff(q, t)
% I want diff(q, t) to give me q_dot
% and diff(q_dot, t) to give me q_ddot in symbolic form

답변 (1개)

Walter Roberson
Walter Roberson 2020년 3월 23일
The only way to get diff(q, t) to return q_dot is if you define
q = int(q_dot, t)
I would suggest to you that instead you do things like
dq = diff(q, t)
f = some expression
f_pretty = subs(f, dq, q_dot)
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 3월 23일
Note that you will need to define q as a function or else the diff() will return 0.
Also I recommend that you read through the first example in the documentation for odeFunction()

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

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by