I have the following mathematical function f=5sin(x), I use the int(f) to obtain the integral of my expression. Is there a way for me to evaluate the result of the integral at a specifc value, lets say 4,32,

3 件のコメント

SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 7 日
% define your function f, and the value a
syms x
a=
f=
I = int(f);
subs(I,x,a)
Ahmed Abdulla
Ahmed Abdulla 2021 年 6 月 7 日
This substitutes x for a but doesnt evaluate the expression :(
Ahmed Abdulla
Ahmed Abdulla 2021 年 6 月 7 日
Thank you Salah, i combined your answer with vpa to evaluate:
vpa(subs(I,x,a))

サインインしてコメントする。

 採用された回答

Walter Roberson
Walter Roberson 2021 年 6 月 7 日

0 投票

syms x
f = 5*sin(x)
f = 
fint = int(f,x,0,x)
fint = 
a = 4.32
a = 4.3200
fa = subs(fint, x, a)
fa = 
If you are expecting a decimal value, then you are wanting to get an approximation at the location, rather than the value at the location.
double(fa)
ans = 6.9120

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

製品

リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by