Why does MatLab give non integer values for whole numbers?
Show older comments
I noticed MatLab sometimes gives ridiculous answers to obvious problems. As an example, I gave it a 2x2 matrix and asked it to give me the null.
A = [1 -1; -2 2]
B = null(A)
it prints out that B is [985/1393; 985/1393] or [0.7071; 0.7071] depending on format.
The answer should be B = [1; 1]
Any thoughts on how to fix this? It has become a problem as sometimes the answer has been 0.7071.
AS an example doing QR factorization of A = [-4 -1; 4 0] yields Q = [-0.7071 0.7071; 0.7071 0.7071]
[Q, R] = qr(A)
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!