Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rewrite the function keeping the Matlab language in as few lines as possible. Use functions from matlab's own languages to shorten it. Look for and

Rewrite the function keeping the Matlab language in as few lines as possible. Use functions from matlab's own languages to shorten it.

Look for and mention possible errors in the function.

------------------------------------------------------------------------------------------------------------------

#Function for calculating Ax=b of a square matrix by the Jacobi method

#A=Coefficient matrix; b=Vector of independent terms; p= random start number #maxItr= maximum number of interactions; maxErr = Maximum tolerance calculated by the waste standard criteria

function x= GaussJacobi (A,b,p, maxItr, maxErr) n=lenght (b); x=p; err= Inf; itr= 0; while itr maxErr xOld=x; for i=1:n sum=0; for j=1:n if j~=i sum= sum + A(i,j)* xOld(j); end if endfor x(i)= (1/A(i,i))*(b(i)-sum); endfor itr= itr+1 err=abs(b-(A*x)); endwhile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

Show the properties and structure of allotropes of carbon.

Answered: 1 week ago