Clear Filters
Clear Filters

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

4 views (last 30 days)
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 :)

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 21 Oct 2012
Edited: Azzi Abdelmalek on 21 Oct 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

More Answers (1)

Jan
Jan on 21 Oct 2012
Edited: Jan on 21 Oct 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))

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!