A question about the evaluation of a derivative obtained via "syms" command

Hello everyone,
I want to request your help with this exercise in MATLAB. I have started a program in which I need to obtain the derivatives of the equations and then these derivatives would be evaluated in some values of the variables from these derivatives, this is what I got so far...
clc;
clear all;
syms x y
%Input of equations
F=sym(inline('x+x^2*y^2-2*y+3'));
G=sym(inline('y-x^3+2*x*y^2-2'));
%Partial derivatives of equations F & G
Fx=diff(F,x);
Fy=diff(F,y);
Gx=diff(G,x);
Gy=diff(G,y);
%Evaluation of partial derivatives at xi=2 & yi=2
xi=2;
yi=2;
EFX=Fx(xi,yi)
EFY=Fy(xi,yi)
EGx=Gx(xi,yi)
EGy=Gy(xi,yi)
However, after the execution of this program the following message is displayed in the command window:
??? Error using ==> mupadmex
Error in MuPAD command: Index exceeds matrix dimensions.
Error in ==> sym.sym>sym.subsref at 1381
B = mupadmex('symobj::subsref',A.s,inds{:});
Error in ==> Newton2dimAutomatizado at 21
EFX=Fx(xi,yi)
I am sure that the derivatives are obtained but for some reason these are not evaluated at the point xi=2 & yi=2. So I can´t obtain a value of these derivatives as result of the evaluation at that point.
Can someone help me?
thanks in advance...

More Answers (0)

Community Treasure Hunt

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

Start Hunting!