Newtons method of rootfinding requires solving a system of l

Newton\'s method of root-finding requires solving a system of linear equations (to avoid using nonlinear optimization routines) at each iteration to ensure maximum computational efficiency. This process involves inverting the Jacobian (see lecture notes and King & Mody pg338), which may not always have an inverse. a. If you are supplied with an arbitrary square matrix, J, write a MATLAB script (or function) that will do the following: If the condition number of J is less than or equal to 20: store the absolute value of the determinant J in the variable det Mag, and ant Is posit det Sign equal to 1 if the determinants positive set the variable and equal to -1 if the determinant is negative If the condition number of J is greater than 20: set det Mag equal to zero and set det Sign equal to the empty matrix Verify that your script is accurate by running your code of matrices on three different J has a positive determinant and a condition number less than 20 J has a negative determinant and a condition number less than 20 iii. J has a condition number greater than 20

Solution

%% Newton methods

clc;

clear all;

close all;

%%

J=[20 20 10

20 10 20

30 30 10];

condition_number(J);

J=[1 20 10

20 10 20

30 30 10];

condition_number(J);

J=[-1 20 10

20 -10 -20

30 30 10];

condition_number(J);

function code is here:

%% Program starts here

function y = condition_number(J)

y=cond(J)

if y<=20

detMag=det(J)

if detMag >=0

detSign=1

else

detSign=-1

end

else

detMag=0

detSign=[]

end

end

  

OUTPUT:

y =

48.9717

detMag =

0

detSign =

[]

y =

4.2780

detMag =

10500

detSign =

1

y =

9.6293

detMag =

-7.5000e+03

detSign =

-1

 Newton\'s method of root-finding requires solving a system of linear equations (to avoid using nonlinear optimization routines) at each iteration to ensure max
 Newton\'s method of root-finding requires solving a system of linear equations (to avoid using nonlinear optimization routines) at each iteration to ensure max

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site