Newtons method for systems in MATLAB Thanks 1 Implement Newt

Newton\'s method for systems in MATLAB. Thanks!

1. Implement Newton?s method for systems to find the solution of to 10 digits of accuracy. Use (0, 0, 0) as the initial guess.

Solution

%initial guess or values

X1=0;

X2=0;

X3=0;

xnew =[x1;x2;x3];

xold = zeros(size(xnew));

while norm(xnew - xold) > tol

    iter= iter + 1;

    xold = xnew;

    % update x1, x2, and x3

    X1 = xold(1);

    X2 = xold(2);

    X3 = xold(3);

    %Defining the functions for x1,x2 and x3.

    f =(x1*x1+x2-33);

    g =(x1-x2*x2-4);

    h =(x1+x2+x3-2);

    %Partial derivatives in terms of x1,x2 and x3.

    Dfdx1 = 2*x1;

    Dfdx2 = 1;

    Dfdx3 = 0;

    Dgdx1 = 1;

    Dgdx2 = -2*x2;

    Dgdx3 = 0;

    Dhdx1 =1;

    Dhdx2 = 1;

    Dhdx3 = 1;

    %Jacobian matrix

    J = [dfdx1 dfdx2 dfdx3; dgdx1 dgdx2 dgdx3; dhdx1 dhdx2 dhdx3];   

    % Applying the Newton-Raphson method

    xnew = xold - J\\[f;g;h];

    disp(sprintf(\'iter=%6.15f, x1=%6.15f, x2=%6.15f, x3=%6.15f\', iter,xnew));

end

Newton\'s method for systems in MATLAB. Thanks! 1. Implement Newton?s method for systems to find the solution of to 10 digits of accuracy. Use (0, 0, 0) as the
Newton\'s method for systems in MATLAB. Thanks! 1. Implement Newton?s method for systems to find the solution of to 10 digits of accuracy. Use (0, 0, 0) as the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site