Error using the integral function - A and B must be floating-point scalars.

.

1 件のコメント

Star Strider
Star Strider 2015 年 11 月 4 日
The original (now deleted) post included this code:
Ginf = 4.0;
t = [0:500]
t1 = 100;
t2 = 500;
y1 = @(t) t/t1;
y2 = @(t) t/t2;
fun1 = @(y)exp(-y)./y;
Eiy1 = integral(@(t)fun1(y1(t)), 0, Inf);
Eiy2 = integral(@(t)fun1(y2(t)), 0, Inf);
E21(y1) = integral((Eiy1)./y, Inf, y1)
E21(y1) = integral((Eiy2)./y, Inf, y2)
G(t) = Ginf -[Eiy1*log(t/y1)-E21(y1)]+[Eiy2*log(t/y2)-E21(y2)]
plot(G(t), t)

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

 採用された回答

Adam Barber
Adam Barber 2015 年 11 月 4 日
Your variables "y1" and "y2" are vectors. The command:
Eiy1 = integral(fun1, Inf, y1)
is really doing the integral of : exp(-y)/y from y = Inf to a vector.
This doesn't really make sense. The bounds (2nd and 3rd input arguments to integral) need to be scalar values.

その他の回答 (0 件)

カテゴリ

タグ

タグが未入力です。

質問済み:

2015 年 11 月 4 日

コメント済み:

2015 年 11 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by