Using the fsolve command to find Turning Points from Jacobian Matrix

After finding the Jacobian Matrix of a function, how would one go about using the command fsolve to find the turning points of the equation? Suppose the equation of the function is f(x,y)= x^(2-x^(0.5))+y^(2-y^(0.5)) . How could one create a script file which calculates the Jacobian matrix and finds the turning points using fsolve? Thanks

2 Comments

How are you defining "turning point" for a multivariable function? It is a concept from 1D calculus.
Hi. The "turning point" that I would like to find is the critical point where all the partial derivatives are equal to zero. Maybe the more 'correct' term would be critical point. Thanks

Sign in to comment.

 Accepted Answer

Perhaps —
syms x y
f(x,y)= x^(2-x^(0.5))+y^(2-y^(0.5))
f(x, y) = 
J = jacobian(f)
J(x, y) = 
Jfcn = matlabFunction(J, 'Vars',{[x,y]})
Jfcn = function_handle with value:
@(in1)[-in1(:,1).^(-sqrt(in1(:,1))+1.0).*(sqrt(in1(:,1))-2.0)-(in1(:,1).^(-sqrt(in1(:,1))+2.0).*1.0./sqrt(in1(:,1)).*log(in1(:,1)))./2.0,-in1(:,2).^(-sqrt(in1(:,2))+1.0).*(sqrt(in1(:,2))-2.0)-(in1(:,2).^(-sqrt(in1(:,2))+2.0).*1.0./sqrt(in1(:,2)).*log(in1(:,2)))./2.0]
format longG
[S,fv] = fsolve(Jfcn, [2 2])
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
S = 1×2
2.11624873396731 2.11624873396731
fv = 1×2
1.0e+00 * 1.78931147676309e-10 1.78931147676309e-10
.

7 Comments

Hi. Thank you very much for the prompt response. However, when I tried this method with this function and others, maybe others with more prominent turning points, it doesn't seem to give the correct coordinates. Is S meant to represent the coordinates of the critical point? Thank you
I have no idea what you want.
I will delete my Answer in a few minutes.
@Samuel Smith Yes, S should be the coordinate of the critical point. We can't do anything about the failure case you mention without seeing it.
Hi, @Matt J, sorry for the late reply. Thank you for clarifying. It is working now perfectly. Could you kindly indicate what 'Vars' and fv indicate please?
The 'Vars' agrument to matlabFunction indicates the variables to be included in the anonyymous function it creates. Putting them in square brackets [] creates a single vector variable called ‘in1’ such that:
in1(1) = x
in1(2) = y
in this instance.
By definition ‘in1’ is always a row vector.
The ‘fv’ variable in the fsolve call is a vector or scalar of the final value of the argument function at convergence.
.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Community Treasure Hunt

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

Start Hunting!