Hello, I have a degree in math and computational physics. I have been writing matlab code for over 5 years. I am familar with linear algebra( matricies). I have written various programs that solve them. WHat is the actual problem that you are having. At a glance your code seems to run okay.
Clay