Hi i cant seem to work out why this error keeps appearing in my code. thanks
x0 = 2;
y0 = 2;
x = [x0; y0];
iter = 0;
max_iter = 100;
tol = 0.1;
err = norm(f(x));
while iter <= max_iter && err >= tol
iter =iter + 1;
x = x - Jacob(x)\f(x);
err = norm(f(x));
end
function y = f(x)
y = (9-x.^2).^0.5;
f(x) = x.^2+y.^2-9;
g(x) = x.^2.*y+y.^3+1;
y = [f(x); g(x)];
end
function y = Jacob(x)
y = (9-x.^2).^0.5;
dfdx(x) = 2.*x;
dfdy(x) = 2.*y;
dgdx(x) = 2.*x.*y;
dgdy(x) = x.^2+3.*y.^2;
y = [dfdx(x) ,dfdy(x); dgdx(x) ,dgdy(x)];
end