So i was solving a system of n linear equations. My coefficient matrix is a tridiagonal one.
However as i was decreasing the values inside matrix or increasing n the error was increasing rapidly.
clearn=1000;B=(1:n);B=B';A=full(gallery('tridiag',n,0.341,0.232,0.741));x=A\B;c=A*x-B;error=0;for i=1:n error=error+abs(c(i,1));enderror%error = 2.174626266011847e+155
Here the system is in the form Ax=B
ideally c should contain only zero.
Can anyone a suggest a method so that i can decrease the net error.
NOTE: I also tried the Thomas Algorithm even that gave an error of similar order .
Best Answer