How to find the derivative without using a symbolic function in Matlab -


i find derivative of function:

function [f] = f4(x)      f=0.5*(x(1)^2+10*x(2)^2); end 

i'm using symbols find jacobian:

x = sym('x', [2 1]); f=0.5*(x(1)^2+10*x(2)^2); grad=jacobian(f,x) 

which returns

grad = [ x1, 10*x2] 

then change manually can use feval:

grad = [ x(1,1), 10*x(2,1)]; 

i find using feval faster using subs. find derivative of function can evaluate using feval , avoid doing manually.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -