Tuesday 15 January 2013

How to differentiate a function w.r.t another symbolic function in MATLAB? -



How to differentiate a function w.r.t another symbolic function in MATLAB? -

using code,

syms x(t) y=x^2 diff(y,t) diff(y,x)

i next error:

2*d(x)(t)*x(t) error using sym/diff (line 26) arguments, except first one, must not symbolic functions.

is there way tackle this? time.

i dont know much symbolic math toolbox, taking derivative wrt function not seem supported (at to the lowest degree in direct fashion) diff.

you can substitute variable, compute derivative, , substitute function back. so:

syms z subs(diff(subs(y,x,z),z),z,x) ans(t) = 2*x(t)

matlab symbolic-math

No comments:

Post a Comment