Finish the function. Output should follow these rules (note it uses functions from above). If diag_dom (A) = 1, use Jacobi iteration to solve the system (Ax = b) and output x (out = x) else, if the iteration matrix, M. for the Jacobi method is such that will_converge(M) = 1, solve using Jacobi Method, output x else, return an empty matrix (i.e.). Function out = iterative_colve (A,b,initial_x, tol) percentage A is a square matrix, b a column vector with equal rows percentage If possible solves Ax = b using Jacobi Method starting with percentage initial_x, ending when norm(A^xx_i -b, inf) etal
function x1 = jacobi2(a,b,x0,tol) n = length(b); for j = 1 : n x(j) = ((b(j) - a(j,[1:j-1,j+1:n]) * x0([1:j-1,j+1:n])) / a(j,j)); % the first iteration end x1 = x\'; k = 1; while norm(x1-x0,1) > tol for j = 1 : n x_ny(j) = ((b(j) - a(j,[1:j-1,j+1:n]) * x1([1:j-1,j+1:n])) / a(j,j)); end x0 = x1; x1 = x_ny\'; k = k + 1; end k x = x1\';