MATLAB: Have a trouble while solving system of linear equations!

matlab errorssolve system of equations

Hi everybody,
I have met a trouble while I try to solve system of linear equations by Matlab. I used LU decomposition algorithm to code a function to solve the system equations. In fact it worked well when I input data by my self. But when I use syms function in Matlab in my main program to name the variables, and use my own function to solve, it appeared an error, the solution is plenty of number and not correct anymore. I really don't understand that problem likes this
So would you please help me to solve this problem?
Thanks in advanced

Best Answer

Call the function digits() passing in the number of decimal places you want the computation to be carried out to. Call vpa() passing in the result of your computation.
If you want the result to be in double precision, usable in other MATLAB computations, then it is not clear why you would do symbolic calculations. None the less, you can use double() to convert symbolic numbers to double precision.