How do you put the constant e on matlab
1.037 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Enrique Man
am 30 Mär. 2018
Kommentiert: Walter Roberson
am 4 Dez. 2024
I'm trying to write an equation with e, but I assume it would just take it as an undeclared variable.
0 Kommentare
Akzeptierte Antwort
Star Strider
am 30 Mär. 2018
3 Kommentare
Steven Lord
am 3 Dez. 2024
Yes, though if you're planning to use it in expressions of the form e^t, instead of computing e separately then raising it to the power t I recommend calling exp with t as an input.
format longg
e = exp(1)
y1 = e^2
y2 = exp(2)
Walter Roberson
am 4 Dez. 2024
As an example of the difference between exp(1)^n and exp(n) :
format long g
e = exp(1);
y1 = e^20; fprintf('%.999g\n', y1);
y2 = exp(20); fprintf('%.999g\n', y2);
y1 - y2
Weitere Antworten (2)
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!