フィルターのクリア

Help: Error using integral (line 85) A and B must be floating point scalars

1 回表示 (過去 30 日間)
Adam
Adam 2014 年 10 月 8 日
コメント済み: Geoff Hayes 2014 年 10 月 8 日
Hey, I am new to Matlab and I am trying to code a graph of the function listed below:
>> x = 10:0.05:20; >> func1 = @(x) 1/sqrt(2*pi)*exp(-x^2/2)
func1 =
@(x)1/sqrt(2*pi)*exp(-x^2/2)
>> func2 = @(x) (13.5-x)*sqrt(30)*(1/5)
func2 =
@(x)(13.5-x)*sqrt(30)*(1/5)
>> y = integral(func1, -9999, func2)
I keep getting this error:
Error using integral (line 85) A and B must be floating point scalars.
Can someone help me fix this error or find a way to circumvent it? Thank you.
  1 件のコメント
Geoff Hayes
Geoff Hayes 2014 年 10 月 8 日
Adam - if you put a breakpoint at line 85 of integral.m, you will understand the error. A and B are the endpoints for your integral and must be floating point scalars. In your case, A is -9999 which is fine, but B is a function handle, func2.
What is your intent of using func2 as an endpoint? If you were to write out your integral (on paper) what would it look like?

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by