Symbolic matlab: how to set a variable as a function of time?
조회 수: 77 (최근 30일)
이전 댓글 표시
Hello to all! I'm trying to set a symbolic variable as a function of "t". This is because I need to obtain something like this:
K>> diff(sin(theta),t)
ans = diff(theta,t)*cos(theta)
or
ans= theta_dot*cos(theta)
but how to tell Matlab that variable theta is a function of time "t"?
Thank you!
댓글 수: 1
Ezequiel Garcia
2017년 4월 18일
편집: Ezequiel Garcia
2017년 4월 18일
You need to declare t as a "symbolic"
syms t;
답변 (4개)
Walter Roberson
2012년 2월 15일
syms theta t
diff(sin(theta(t)),t)
댓글 수: 2
Walter Roberson
2017년 4월 19일
In newer versions of MATLAB, you can use
syms theta(t)
diff(sin(theta),t)
Sergei Sergienko
2020년 6월 13일
Is it possible to make vector function of t? Something like this
sym('q(t)', [3 1])
diff(sin(q),t)
Wayne King
2012년 2월 15일
Hi Sebastian, do you know the expression for theta(t)?
syms theta t;
theta(t) = t^2;
diff(cos(theta),t)
댓글 수: 0
Sebastian D'Amico
2012년 2월 15일
댓글 수: 1
Wayne King
2012년 2월 15일
Do you really need that if you do not know the expression for theta(t), you know df(theta)/dt = df/dtheta*dtheta/dt
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Variables, Expressions, Functions, and Preferences에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!