Why doesn't the minor matrix match?

Please check my script
I'm working on an assignment to find the determinant using minor. I'm confused why minor doesn't match with the result, so that the final result is not same as the original determinant
syms L
disp('----------------------------------------------------------------');
% Use minors to expand the above determinant:
A = [2-L 8 10;8 4-L 5;10 5 7-L];
disp(A)
disp('x is lambda');
disp('----------------------------------------------------------------');
M11 = A([2,3],[2,3])
M12 = A([2,1],[2,3])
M13 = A([2,1],[2,2])
DM = A(1,1)*det(M11)-A(1,2)*det(M12)+A(1,3)*det(M13)
det(M11)
det(A)
please help me

 採用された回答

Cris LaPierre
Cris LaPierre 2020 年 12 月 19 日

0 投票

It looks like you have not correctly implemented the expansion of minors. Check your M arrays.

3 件のコメント

Jaemon Hon
Jaemon Hon 2020 年 12 月 19 日
I managed to make a minor like this
M11 = A(2:3,[2,3])
M12 = A(2:3,[1,3])
M13 = A(2:3,[1,2])
and it worked
but, I don't know why the result didn't immediately calculate like this
- L^3 + 13*L^2 + 139*L - 42
on Command Window appears like this
DM = 164*L - (L - 2)*(L^2 - 11*L + 3) - 48
Cris LaPierre
Cris LaPierre 2020 年 12 月 19 日
MATLAB doesn't "know" how you want it to appear. It provided an equivalent solution.
Add this after you compute DM.
simplify(DM)
Jaemon Hon
Jaemon Hon 2020 年 12 月 19 日
I did it, thank you very much sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2013a

質問済み:

2020 年 12 月 19 日

コメント済み:

2020 年 12 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by