function of integral bound
2 ビュー (過去 30 日間)
古いコメントを表示
I want to solve for b where (the integrands are more complex so that I can't compute the integral myself).
I tried the following
f1=@(x) 1;
f2=@(a,b) integral(f1,0,a+b);
f3=@(b) (integral2(f2,0,b,0,0)-1)^2;
fminunc(f3,0,options);
but I get the error message that A and B must be floating-point scalars.
I appreciate any help. Thanks.
0 件のコメント
採用された回答
Torsten
2019 年 5 月 3 日
function main
sol = fzero(@fun,1.0)
end
function res = fun(b)
amin = 0;
amax = b;
xmin = 0;
xmax = @(a) a+b;
f = @(x) ones(size(x));
res = integral2(@(a,x)f(x).*a,amin,amax,xmin,xmax) - 1.0;
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!