Scilab, tridiag function

SilLAwNeD Nov 15th, 2018 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function [x,k]=tridiag(n)
  2.     v1 = ones(n-1,1);
  3.     v2 = 3*ones(n,1);
  4.     A = diag(v1,-1)+diag(v2,0)+diag(v1,1);
  5.     b = ones(n,1);
  6.     [x,k]=gausseidel(A,b,1e-12,10,ones(n,1));
  7. endfunction
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand