exp doesn't return the expected values
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ahmed
el 22 de Jul. de 2022
Comentada: Steven Lord
el 22 de Jul. de 2022
I have a matrix which is defined like this
x = [1 2 3; 4 5 6; 7 8 9];
y = exp(x)
Why am I getting this result ? I expected a matrix which contains element by element exp
0 comentarios
Respuesta aceptada
Star Strider
el 22 de Jul. de 2022
That is esactly what it is doing —
format longG
x = [1 2 3; 4 5 6; 7 8 9];
y = exp(x)
y11 = exp(1)
y33 = exp(9)
What were you expecting?
.
3 comentarios
Star Strider
el 22 de Jul. de 2022
No worries!
The ‘1.0e+3’ in the upper left of the display indicates that the entire displayed matrix is multiplied by the inverse of that number, ‘1E-3’ in this instance.
.
Steven Lord
el 22 de Jul. de 2022
I'm guessing they missed the factor of 1.0e+03 in the upper-left corner of the matrix and so thought MATLAB was returning 0.0027 for exp(1) when they expected 2.71828...
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!