Why I can't get the solution from integral function?

k= 0.2; %thermal conductivity
lambda= 2.4048; %eigenvalues
t=5; %time interval
fun1=@(t) exp(k.*lambda.^2.*t);
q1=integral(fun1,0,5);
C1=Amn.*exp(-k.*lambda.^2.*t);
Z=exp(-k.*lambda.^2.*t);
Tmn(t)=Z.*q1+C1
Command window
Undefined function or method 'integral' for input arguments of type 'function_handle'.
Error in ==> at 6
q1=integral(fun1,0,5);

回答 (1 件)

madhan ravi
madhan ravi 2018 年 11 月 28 日
編集済み: madhan ravi 2018 年 11 月 28 日

0 投票

If you have an older version of matlab try using quad() released in 2006a but look into quadgk() as suggested by sir Walter.
instead of integral() released in 2012a
My version is 2018b
I got the solution though:
>> k= 0.2; %thermal conductivity
lambda= 2.4048; %eigenvalues
t=5; %time interval
fun1=@(t) exp(k.*lambda.^2.*t);
q1=integral(fun1,0,5)
q1 =
279.9143
>>

4 件のコメント

Walter Roberson
Walter Roberson 2018 年 11 月 28 日
quadgk was often better than quad. The best numeric integrater to use dependes in part on whether your boundaries were infinite .
madhan ravi
madhan ravi 2018 年 11 月 28 日
Thank you sir Walter but the release date is not mentioned in the doc
Walter Roberson
Walter Roberson 2018 年 11 月 28 日
r2007b for quadgk
madhan ravi
madhan ravi 2018 年 11 月 28 日
Thank you sir Walter :)

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

タグ

質問済み:

2018 年 11 月 28 日

コメント済み:

2018 年 11 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by