Integral a function handle of two variables with respect to a variable

15 ビュー (過去 30 日間)
Jingyu Liu
Jingyu Liu 2021 年 12 月 2 日
コメント済み: Jingyu Liu 2021 年 12 月 2 日
f = @(x, y) x+y;
g = @(x) integral(@(y) f(x,y),0,1)
t = (0:0.1:1);
g(t)
It is wrong! How can I get the expected result?

採用された回答

Walter Roberson
Walter Roberson 2021 年 12 月 2 日
f = @(x, y) x+y;
g = @(x) integral(@(y) f(x,y), 0, 1, 'arrayvalued', true)
g = function_handle with value:
@(x)integral(@(y)f(x,y),0,1,'arrayvalued',true)
t = (0:0.1:1);
g(t)
ans = 1×11
0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 1.2000 1.3000 1.4000 1.5000

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by