I need to create a loop to evaluate a function at decreasing points.
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
DJ Mckenna
am 18 Mai 2023
Kommentiert: DJ Mckenna
am 18 Mai 2023
I need to evaluate the function ( (e^x)-e^(-x))/x at values starting from 1e-6, 1e-7, 1e-8... to 1e-17 and have each output be stored in a table. How can I do this?
0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 18 Mai 2023
Bearbeitet: Dyuman Joshi
am 18 Mai 2023
If you want to store the output in a specific way, please mention the output format.
format long
%define x
x = 10.^-(6:17)
f = (exp(x)-exp(-x))./x
Weitere Antworten (1)
Torsten
am 18 Mai 2023
Verschoben: Torsten
am 18 Mai 2023
digits(100)
vpa((exp(sym('1/10'))-exp(sym('-1/10')))/sym('1/10'))
vpa((exp(sym('1/1000000'))-exp(sym('-1/1000000')))/sym('1/1000000'))
vpa((exp(sym('1/10000000'))-exp(sym('-1/10000000')))/sym('1/10000000'))
vpa((exp(sym('1/100000000000000000'))-exp(sym('-1/100000000000000000')))/sym('1/100000000000000000'))
I think you should be able to read the documentation on how to create a table for the results.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!