Equation how to evaluate and obtain a value

10 ビュー (過去 30 日間)
Mato Lab
Mato Lab 2016 年 12 月 25 日
回答済み: John BG 2016 年 12 月 25 日
Hi
I have create an equation
syms x
f(x) = exp(5*x);
df(x) = diff(f,x);
and then I want to evaluate f and df when x = 2
f(2)
Df(2)
But the result is not a value. I obtain f(2) = exp(10) df(2) = 5 exp (10)
How can I calculate to obtain a value : f(2) = 2.2026e+04 df(2)= 1.1013e+05

採用された回答

Andrei Bobrov
Andrei Bobrov 2016 年 12 月 25 日
Please try use function vpa:
syms x
f(x) = exp(5*x);
df(x) = diff(f,x);
vpa(f(2))
vpa(df(2))

その他の回答 (1 件)

John BG
John BG 2016 年 12 月 25 日
just change the type
syms x
f(x) = exp(5*x);
df(x) = diff(f,x);
double(f(2))
=
2.202646579480672e+04
and
double(df(2))
=
1.101323289740336e+05
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, if you find this answer of any help, please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by