From: Max Carlson on 18 Feb 2010 22:20 Basically what I need to do is code a tridiagonal solver and be able to implement it with sparse matrices. Right now I feel my code is a bit off and I am not sure what I need to tweak. So far I have: function x = project2(a,b,c,d,n) for i = 2:n s= -a(i-1)/b(i-1); b(i)= b(i)+c(i-1)*s; d(i)= d(i)+b(i-1)*s; end x(n)=d(n)/b(n); for i = n-1:-1:1 x(i)= (b(i)-c(i)*x(i+1))/b(i) end Keep in mind I am pretty new to Matlab and new to programming in general, so any help I can get would be greatly appreciated. Thanks.
|
Pages: 1 Prev: Reading in and editing an m file Next: Crash while starting Matlab 2009b on Snow Leopard |