Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
Adam
Adam am 21 Okt. 2012
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 :)

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 21 Okt. 2012
Bearbeitet: Azzi Abdelmalek am 21 Okt. 2012
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

Weitere Antworten (1)

Jan
Jan am 21 Okt. 2012
Bearbeitet: Jan am 21 Okt. 2012
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))

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by