Matrix Equality Check Failed Using == and isequal
Afficher commentaires plus anciens
Hello guys,
I am confused about how MATLAB handles matrix equailty check. Consider the following example,
a = [262 -200; -200 200];
a_inv = inv(a);
% since it is a 2 by 2 matrix, we can perform inv operation like this
b = (1/(262 * 200 - 200*200)) * [200 200; 200 262];
a_inv == b
% 2×2 logical array
%
% 0 0
% 0 0
isequal(a_inv, b)
% ans =
%
% logical
%
% 0
But when I print these matrix, it gives me exact same result
format long
a_inv
a_inv =
0.016129032258065 0.016129032258065
0.016129032258065 0.021129032258065
b
b =
0.016129032258065 0.016129032258065
0.016129032258065 0.021129032258065
Not sure which step did I do wrong? ang suggestion to compare matrix properly?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!