フィルターのクリア

Problem with computing an integral of a function

1 回表示 (過去 30 日間)
Dimitris M
Dimitris M 2013 年 2 月 27 日
コメント済み: Masoud Aghajani 2020 年 8 月 4 日
Hello
I have problem computing the integral of a function:
The function is the following
fun = @(t) sin(2*pi*t*697)*(sin(2*pi*t*941)+sin(2*pi*t*1477))
Is strange cause when I compute eg. fun(2) everything seems to work, then when I am trying to compute the integral (see below I getting an error)
integral(fun,0,4)
Can someone please inform me on my mistake ?
Regards
  3 件のコメント
Dimitris M
Dimitris M 2013 年 2 月 27 日
The error is the following:
Error using *
Inner matrix dimensions must agree.
Error in @(t)sin(2*pi*t*697)*(sin(2*pi*t*941)+sin(2*pi*t*1477))
Error in integralCalc/iterateScalarValued (line 314)
fx = FUN(t);
Error in integralCalc/vadapt (line 133)
[q,errbnd] = iterateScalarValued(u,tinterval,pathlen);
Error in integralCalc (line 76)
[q,errbnd] = vadapt(@AtoBInvTransform,interval);
Error in integral (line 89)
Q = integralCalc(fun,a,b,opstruct);
Isaac
Isaac 2013 年 10 月 3 日
編集済み: Isaac 2013 年 10 月 3 日
fun = @(t)sin(2*pi*t*697).*(sin(2*pi*t*941)+sin(2*pi*t*1477)), integral(fun,0,4)

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

採用された回答

Babak
Babak 2013 年 2 月 27 日
change the fun to
fun = @(t) (sin(2*pi*t*697).*(sin(2*pi*t*941)+sin(2*pi*t*1477)))
  1 件のコメント
Masoud Aghajani
Masoud Aghajani 2020 年 8 月 4 日
This helped me 7 years later.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by