How to do partial differentiation of functions?

2 次查看(过去 30 天)
x10=2;
x20=-2;
x30=1;
e1=0.00001;
z = sym('2*x1 * x1 + x2*x2 + 3*x3*x3');
syms x1 x2 x3 a;
gradz = [diff(z,x1); diff(z,x2); diff(z,x3)]; % returns a column vector
p0=subs(gradz, [x1 x2 x3], [x10 x20 x30]); % evaluate at (0.25, 0.75)
x1a0=x10+a*p0(1);
x2a0=x20+a*p0(2);
x3a0=x30+a*p0(3);
This is some part of code. i want to do partial differentiation of particular function w.r.t. variables x1,x2,x3. How to do it numericaly. Its working when i am doing it by using symbolic toolbox. How to do it by using already stored syntax....like 'ode 45'(i know ode cant solve above problem....i have just mentioned to specify type).

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by