

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is matlab code for Numerical Methods course by Zain Rathore at Bengal Engineering
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


function [Q]=jaccobi(a) clc; w=[0 0 0 0]; w=w'; x=[0 0 0 0]; x=x'; b=[3 2 1 5]; b=b'; n=3; k=1; N=100; TOL=.001; while k<=N for i=1:n x(i)=(-(a(i,1:i-1)w(1:i-1)+a(i,i+1:n)w(i+1:n))+b(i))/a(i,i); if abs(max(x-w))<TOL disp('procedure succesful') x return end k=k+1; for i=1:n w(i)=x(i);
end end end