필터 지우기
필터 지우기

Why matlab live editor and matlab script gives different rank calculation result for the same matrix ?

조회 수: 1 (최근 30일)
I suddenly found matlab is misundesrstanding this matrix and checked it with matlab live editor. Then, matlab live gives the right rank .Why is that happened ? appreciated !
M =[-0.0000 0.0000 0 0 0 -0.0000;...
-0.0000 0.0000 0 0 0 -0.0000;...
0 0 1.0000 0 0 0;...
0 0 0 1.0000 0 0;...
0 0 0 0 1.0000 0;...
0.0000 0.0000 0 0 0 0.0000]
Thank you !

채택된 답변

Matt J
Matt J 2020년 10월 21일
Probably because you copy-pasted the values of M from the screen to one of the scripts.
  댓글 수: 3
Matt J
Matt J 2020년 10월 21일
Since you accept-clicked my answer, it appears that you solved the problem?
HN
HN 2020년 10월 21일
편집: HN 2020년 10월 21일
Thank you Matt J , yes the problem is solved. You were right. What puzzeles me was the difference.
Thanks a lot 1

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

추가 답변 (1개)

Steven Lord
Steven Lord 2020년 10월 21일
The value MATLAB displays is sometimes not the value MATLAB uses in computations.
>> format short
>> x = 1 + 1e-8
x =
1.0000
>> x == 1
ans =
logical
0
>> y = x - 1
y =
1.0000e-08
>> format longg
>> x
x =
1.00000001
Under the short display format, even though x is not equal to 1 it is displayed as 1.0000. If it were exactly one, y would be exactly 0. When I change the display format to longg, you can see that it is not exactly one.
  댓글 수: 2
HN
HN 2020년 10월 21일
Steven Lord , Thank you. You are right ! What confuses me was the contraditing result between matlab live script and matlab scrpt.
Steven Lord
Steven Lord 2020년 10월 21일
Is one using the computed value of x and one the displayed value via copy and paste? How are you ensuring you're using the exact same values, down to the last bit, in the two programs?

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by