To find saddle point, maxima or minima using the second derivative in MATLAB, you can follow these steps:
f(x,y)
in MATLAB.f
using the hessian
function in MATLAB.eig
function in MATLAB.Here's an example MATLAB code:
main.m486 chars19 lines
In this example, the f(x,y)
function is x^3 - 3*x*y^2
. The hessian
function is used to calculate the Hessian matrix of f
, and the eig
function is used to find the eigenvalues of the Hessian matrix. Finally, the code analyzes the eigenvalues to determine the type of critical point.
gistlibby LogSnag