exp doesn't return the expected values
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Star Strider
il 22 Lug 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 Commenti
Star Strider
il 22 Lug 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
il 22 Lug 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...
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!