why can't i see the values of the numbers in my matrix?
Show older comments
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
More Answers (1)
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!