% I'll get you started with the matrix in Problem 1, p. 124. % Notice that the first row and last row are different than % the others, so we'll manipulate those last. % % Also see JacobiExample1.m that we looked at briefly on Wed, Mar 11 % n=10; %Number of equations B=[ones(n,1) -4*ones(n,1) 6*ones(n,1) -4*ones(n,1) ones(n,1)]; d=[-2 -1 0 1 2]; %See the help file to see how the diagonals are labeled: % help spdiags A=spdiags(B,d,n,n); A(1,1)=12; A(1,2)=-6; A(1,3)=4/3; A(n,n-2)=4/3; A(n,n-1)=-6; A(n,n)=-12;