필터 지우기
필터 지우기

why can't i see the values of the numbers in my matrix?

조회 수: 4 (최근 30일)
Adam
Adam 2012년 10월 21일
i have used the ode23() function, to find a solution of some differential equations. As out put i gives me a cetor "t", and a matrix "x" with the solutions.
The problem is that i can't see the calculated values in the "x" matrice. in the works space window there is no problem, and for example the first column of the matrix looks something like this:
col 1:
1,00000000000000
0,999339985727093
0,995074819302742
0,983756810994156
0,961909664741749
0,926035719167643
...
but if i type "x(:,1)" in the command window, this is my output:
ans =
1.0e+018 *
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
...
why does it say 1.0e+18 ?
if i type "x(4,1)" i'll get this:
ans =
0.9838
so clearly the numbers are there, but i can't see them or use them, because of the 1.0e+18
This gives me a problem when i want to use the solution to calculate something, and it also gives me a problem if i want to plot the solution. I just can't see anything but zero unless the numbers get large enough, which they does at the end of the timescale.
does anybody know, why this happens?
thx :)

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 21일
편집: Azzi Abdelmalek 2012년 10월 21일
It says 1.0e+18 because, some of your numbers are near 1.0e+18. It will not display 123444444444444444. then the other numbers which are smaller, for example 10 will be displayed 0.00000000000000001 e+18, because of your short or even long format you will see
0.0000 e+18

추가 답변 (1개)

Jan
Jan 2012년 10월 21일
편집: Jan 2012년 10월 21일
Type this in the command window to change the display of the numerical values:
format long g
Alternatively you can avoid using the display command, which is called implicitly, and use fprintf instead:
fprintf('%g\n', x(:,1))

카테고리

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