Hi
Please help me. I integrate exponential function
A = 0.99884288089923034958045305504472 * exp(-0.000069357701673937357644134094059041*t) + 0.00065099780621249439169711353325784 * exp(-1.0011868295870502976185889565386*t) + 0.00050612129455715694285117888048433 * exp(-1.0000609127112756180366659464198*t)
using
fun=@x A
q=integral(fun,0,Inf)
but there are error occurred. the answer should be 14401
thanks in advance

1 件のコメント

Walter Roberson
Walter Roberson 2016 年 1 月 7 日
You cannot get anywhere close to that precision using double precision values. To use the precision implied here, you would need to use the Symbolic Toolbox.

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

回答 (1 件)

Torsten
Torsten 2016 年 1 月 7 日

0 投票

int_A=@(t) -0.99884288089923034958045305504472/0.000069357701673937357644134094059041*exp(-0.000069357701673937357644134094059041*t) - 0.00065099780621249439169711353325784/1.0011868295870502976185889565386*exp(-1.0011868295870502976185889565386*t)-0.00050612129455715694285117888048433/1.0000609127112756180366659464198*exp(-1.0000609127112756180366659464198*t);
q=int_A(Inf)-int_A(0);
Best wishes
Torsten.

2 件のコメント

ifwat arif
ifwat arif 2016 年 1 月 7 日
can I just link directly a to the int_A=@(t)?
if true
a=-0.99884288089923034958045305504472/0.000069357701673937357644134094059041*exp(-0.000069357701673937357644134094059041*t) - 0.00065099780621249439169711353325784/1.0011868295870502976185889565386*exp(-1.0011868295870502976185889565386*t)-0.00050612129455715694285117888048433/1.0000609127112756180366659464198*exp(-1.0000609127112756180366659464198*t);
int_A=@(t) a;
q=int_A(Inf)-int_A(0);
end
i tried but got the wrong answer
Walter Roberson
Walter Roberson 2016 年 1 月 7 日
No. In your assignment to a, t had to already have been defined and have a specific value, and that specific value would have been calculated with, resulting in a numeric a (unless t was a symbolic variable.)
In the construct Torsten shows, t becames the temporary name of the value passed in to the function handle, and that passed in value is used to evaluate the expression.

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

カテゴリ

質問済み:

2016 年 1 月 7 日

コメント済み:

2016 年 1 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by