Generating Tridiagonal matrix right hand values on Matlab
for a tridiagonal matrix, where the matrix is nxn, the right hand side is: b_i = 6/h^2*(y_i+1-2*y_i+y_i-1), i = 1...n where y_i = cos(i*h), i = 0...n+1 and h = pi/(n+1).
Instead I just wrote the equation as b_i+1 = 6/h^2*(cos((i+2)*h) - 2*cos((i+1)*h) + cos(i*h), where h = pi/(n+1) since it seemed easier to organize.
I want to solve the tridiagonal system and analyze what happens when n increases. But I'm not sure how to do this.
Here's what I have so far:
Please help. Thanks so much!