MATLAB: Tridiagonal matrix

equationgallerytridiagtridiagonal matrix

Hi there. i have this equation | 0.99y(i+1) -2y(i) +2.01y(i-1)=0,0002 | i want i from 1 to 99. So i will have 99 equations with 99 unknowns. The first step is to make a tridiagonal matrix and store the numbers : 0.99 , -2 , 2.01 . How can i do that ?

Best Answer

TD = full(gallery('tridiag',100,0.99 , -2 , 2.01))
EDIT Per Comment:
y = TD\B;