Can someone help me with symbolic differentiation?

1 view (last 30 days)
Hi,
I'm trying to differentiate a vector of fuctions in order to a vector of variables and I keep getting the error:
??? Undefined function or method 'Diff' for input arguments of type 'sym'.
My code is:
NVar=4;
NConstr=2;
syms x y z w;
Var=[x y z w];
Phi=[x+y+z+w;x*y+z^2+w^3*z];
for i=1:NConstr
for j=1:NVar
TempVar2=Diff(Phi(i,1),Var(j));
end
end
The purpose of this code is to aplly it to my master thesis, where I need to differentiate a (47X1) constraint vector in order to a vector of coordinates that is (102X1). Can anyone help me?
Best regards,
Paulo

Accepted Answer

Wayne King
Wayne King on 25 Apr 2013
The immediate cause of your problem is that MATLAB is case-sensitive and you want to use diff(), not Diff()

More Answers (2)

Andrei Bobrov
Andrei Bobrov on 25 Apr 2013
TempVar2 = jacobian(Phi,Var);

Paulo Francisco
Paulo Francisco on 25 Apr 2013
Thank you both, it's working now.
Paulo

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!