Error in command window
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Khushank Singhal
el 11 de Dic. de 2017
Comentada: Guillaume
el 11 de Dic. de 2017
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 comentario
Respuesta aceptada
Jan
el 11 de Dic. de 2017
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 comentarios
Jan
el 11 de Dic. de 2017
"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
el 11 de Dic. de 2017
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!