Use the following template.
Convergence Speed Problem
% Generate your matrices A, D, L and U here.
% Generate your iteration matrices for Jacobi and GS here.
% Compute the spectral radius here for J and G. Use the function max and abs.
% Compute the convergence rate here. Do not change the names crJ and crGS.
% Generate your matrix, rhs b, initial guess and tolerance here.
x=sgs(A,b,x0,eps); % make sure to name your solution x.
% Write your function here. Similar structure can be used here.
% Check homework solutions for sample codes.