I tried to develop a code in MATLAB to solve 3 nonlinear equations using newton raphson method, but it seems that the code is not working, does anyone have the ability to fix it:
function [root,ea1,ea2,ea3,iter]=newtraph(xr,yr,zr,func,jac,es,maxit)
% Define f(x)
func(xr,yr,zr) = [(xr^2)+(2*xr*yr*zr)+(3*yr^2); (xr*yr)+(yr*zr); (yr*xr^2)+(8*zr)];
% Define Jacobian matrix
jac(xr,yr,zr) = [2*xr+2*yr*zr 2*xr*zr+6*yr 2*xr*yr; yr xr+zr yr; 2*yr*xr xr^2 8];
if nargin