You are on page 1of 1

CSE 403 Programming Assignment 2

Jacobi Method Write a MATLAB function to implement the Jacobi-Method to solve a system of linear equations of the form Ax=b function [x, err] = jacobi(A, %input % A = the matrix A in Ax = % b = the matrix b in Ax = % x0 = initial guess % maxIter = maximum number %output %x = Solution %err = ||Ax b|| endfunction Display the history of the solution(matrix), and the iteration level Determine whether the iterations will converge or may diverge, and displays an appropriate message. (NB: You can only know if it will for sure converge, but not if it will for sure diverge.) Check if the matrix A is square, and display an error message that it can not handle it. (NB: it can be handled, but I don't want u to do that now) Check if the matrix b is a column vector Check if the initial guess, x0, is a column vector of the same as the matrix b Check if the matrix A and the matrix b have the compatible dimensions, and display an error message and exits if that is not satisfied. Check if tolerance and maximum iteration values are numeric and display appropriate messages if they are not. b, x0, tol, maxIter) b b of iterations

Deadline: department specific Weight: 10% Work: Individual Submission media: moodle

You might also like