Error in command window
1 回表示 (過去 30 日間)
古いコメントを表示
In my code, I am computing a variable successively in a loop (updating it again and again). After a couple of iterations, it shows NaN.
2.0375 18.6761 1.9703 -13.3317 -1.6461 0.7139
0.6603 6.9174 2.7097 -1.0691 -0.6152 0.5390
3
1.0e+03 *
Columns 1 through 13
-0.8846 -0.0211 -0.0078 -0.0014 0.0002 0.0008 0.0009 0.0009 0.0009 0.0106 1.1095 0.0010 -0.0308
-0.0163 -0.0001 -0.0010 0.0006 0.0009 0.0010 0.0010 0.0009 0.0008 0.0011 0.0147 0.0042 0.0014
here it can be seen that at third iteration, there is some kind of error and elements have abruptly become close to zero. How can it be avoided?
1 件のコメント
採用された回答
Jan
2017 年 12 月 11 日
Seriously? You do not show any detail of the code, but only the output values and assume, that the readers of the forum can suggest a modification?
If You Matlab code computes at first values near to 0 and afterwards NaNs, this will be the correct result of the programmed formula. Perhaps either your code contains a bug, or your expectation is wrong, that the result is non NaN.
3 件のコメント
Jan
2017 年 12 月 11 日
"1.0e+03 * ..." means that the following values are multiplied by this factor. Matlab uses this for a more compact output to the command window, but it does not concern the data.
1.0e+03 *
3.145 876
is exactly the same as:
3145 876000
Guillaume
2017 年 12 月 11 日
format longg
may make the display more palatable for you. Note that in no way does it change the actual values calculated by matlab, only the way they are displayed.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!