matlab - How to get symbolic partial derivative with respect to time -


let's have function

f(t) = 4*sin(a(t)) + x(t)*y(t) + h + cos(y(t))*sin(x(t)) 

how compute derivative respect time?

you need declare variables , functions inside being symbolic , use diff:

clear clc  syms x y t h  a(t) = symfun(sym('a(t)'), t) x(t) = symfun(sym('x(t)'), t) y(t) = symfun(sym('y(t)'), t)  f = 4*sin(a(t)) + x(t)*y(t) + h + cos(y(t))*sin(x(t))  derf_t = diff(f,t) 

giving following (messy) output:

f =   h + 4*sin(a(t)) + cos(y(t))*sin(x(t)) + x(t)*y(t) derf_t =   x(t)*diff(y(t), t) + y(t)*diff(x(t), t) + 4*cos(a(t))*diff(a(t), t) + cos(x(t))*cos(y(t))*diff(x(t), t) - sin(x(t))*sin(y(t))*diff(y(t), t) 

note since a(t),x(t) , y(t) defined functions of 't' stuck 'symbolic' derivative (i don't know term sorry)...i.e. diff(a(t)) instance.

hope it's after!


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -