How to evaluate my integral

4 ビュー (過去 30 日間)
DESANCE
DESANCE 2014 年 4 月 10 日
コメント済み: Star Strider 2014 年 4 月 11 日
I tried to evaluate this integral:
exp(7.313 x)/(x^2+1.7439)dx on the interval 0 to 0.001.
Then I had this kind of error : Unexpected MATLAB expression. So how do I write and evaluate it?
Thank you.

採用された回答

Star Strider
Star Strider 2014 年 4 月 10 日
I suggest:
f = @(x) exp(7.313.*x)./sqrt(x.^2+1.7439);
fi = integral(f, 0, 0.001)
produces:
fi =
760.0254e-006
  4 件のコメント
Matt Tearle
Matt Tearle 2014 年 4 月 11 日
You're missing the exp in the numerator... :)
Star Strider
Star Strider 2014 年 4 月 11 日
Good catch!
Didn’t see that. I assumed ‘copy and paste’ meant everything.

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

その他の回答 (1 件)

Matt Tearle
Matt Tearle 2014 年 4 月 10 日
Hard to say what's causing the error without seeing the actual MATLAB code you used. But regardless, if you just want the numerical value, you can do that using integral (or similar functions):
f = @(x) exp(7.313*x)./sqrt(x.^2+1.7439);
integral(f,0,0.001)
The first line creates a function handle that defines the function of a single variable (x). Note the use of vector operations (such as ./) because integral will evaluate the integrand at a bunch of points simultaneously.
The second line uses integral to do the quadrature.
(You can also do symbolic integration with Symbolic Toolbox.)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differentiation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by