does mldivision have any exceptions? I used it to solve an equation and the values I got were wrong.

3 views (last 30 days)
I tried solving the 9x9 system of equations as shown below.
after solving for X, I wanted to crosscheck my values so i run the syntax A*X==B and I did not get true(or 1) for all the values in the comparison. When I calculated it manually, I got a different answer which seemed right after recalculating and crosschecking.
what could be the problem?

Answers (1)

Roger Stafford
Roger Stafford on 14 Oct 2014
Edited: Roger Stafford on 14 Oct 2014
You mustn't use "==" to check your answers because that doesn't allow for round-off errors. I checked the answers you obtained and they are correct to within reasonable round-off errors, which means they are correct out to about the fourteenth or fifteenth decimal place. Try using 'format long' to compare them. That is all you can reasonably expect from your computer using double precision floating point numbers.
In point of fact some of the theoretical values are fractions that cannot be represented exactly on either a decimal or a binary computing system, so it is not difficult to imagine that A*X and B may not be precisely the same. They actually differ only out in the least significant few bit positions.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!