Help using old version of Matlab Student

조회 수: 12 (최근 30일)
phillip
phillip 2012년 8월 30일
답변: Manoj Kumar 2019년 5월 9일
Hi, I periodically use an old version 5 student edition. I'm having a rather small err large problem.
This is what happens
a=[.95 .03 .05 .97]
a =
0.9500 0.0300
0.0500 0.9700
b=a-eye(2)
b =
-0.0500 0.0300
0.0500 -0.0300
det(b)
ans =
2.7756e-018
clear
b=[-.05 .03 .05 -.03]
b =
-0.0500 0.0300
0.0500 -0.0300
det(b) ans =
0
What's happening here? Thanks.
  댓글 수: 1
Manoj Kumar
Manoj Kumar 2019년 5월 9일
What's wrong ?
det(b) = 0 is equivalent to det(b) = 2.7756 x 10^*(-18) =0.

댓글을 달려면 로그인하십시오.

채택된 답변

Daniel Shub
Daniel Shub 2012년 8월 30일
This is FAQ 6.1 wrapped up in a different way. FAQ 6.1 considers
>> 0.3 - 0.2 - 0.1
ans =
-2.7756e-17
The answer is the limited precision of floats. Using the same approach outlined in the FAQ gives:
>> sprintf('%20.18f\n', [.95 .03; .05 .97]-eye(2))
ans =
-0.050000000000000044
0.050000000000000003
0.029999999999999999
-0.030000000000000027
>> sprintf('%20.18f\n', [-.05 .03 .05 -.03])
ans =
-0.050000000000000003
0.029999999999999999
0.050000000000000003
-0.029999999999999999

추가 답변 (1개)

Manoj Kumar
Manoj Kumar 2019년 5월 9일
What's wrong ?
det(b) = 0 is equivalent to det(b) = 2.7756 x 10^*(-18) =0.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by