How to take time derivatives of an function?

27 views (last 30 days)
For example, f=cos(theta)+sin(beta)+theta_dot, and the first derivative of theta with respect to time t is theta_dot, and for beta is beta_dot. Then take derivatives of theta_dot and beta_dot again with respect to t are theta_dotdot and beta_dotdot respectively.
So take first derivative of f about t would be df/dt=-theta_dot*sin(theta)+beta_dot*cos(beta)+theta_dotdot. How can I write an function to achieve this?

Accepted Answer

KSSV
KSSV on 20 Sep 2016
syms theta(t) beta(t)
f = cos(theta)+sin(beta)+diff(theta,t) ;
f_dot = diff(f,t) % first derivative of wrt t
diff_dot2 = diff(f_dot,t) % second derivative of wrt t
  9 Comments

Sign in to comment.

More Answers (1)

Lubah Nelson
Lubah Nelson on 23 May 2018
for i = 1:length(D)-2 f_D(i) = ( (-3*D(i)) + (4*D(i+1)) - (D(i+2))) / (2 * (D(i+1) - D(i))); end

Community Treasure Hunt

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

Start Hunting!