Multiple integrals with limits as variables

1 回表示 (過去 30 日間)
Mauricio
Mauricio 2014 年 9 月 16 日
コメント済み: Mauricio 2014 年 9 月 18 日
I have the function f(z,w,l) and I want to obtain a function g(z) by integrating f(z,w, l) as follows: I need to integrate f for 0 < l < w and then perform the integral for 0 < w < L; where L is a constant. Note that w is a variable while L is a number. I would appreciate any suggestions. Thanks

採用された回答

Mike Hosea
Mike Hosea 2014 年 9 月 16 日
編集済み: Mike Hosea 2014 年 9 月 16 日
function_of_scalar_z_only = @(z)integral2(@(w,l)f(z,w,l),0,L,0,@(w)w);
g = @(z)arrayfun(function_of_scalar_z_only,z);
Depending on how f is written, you may need to manually expand the scalar z.
function_of_scalar_z_only = @(z)integral(@(w,l)f(z*ones(size(w)),w,l),0,L,0,@(w)w);
g = @(z)arrayfun(function_of_scalar_z_only,z);
As the long function name suggests, that first function is only good for a scalar input. The ARRAYFUN modification "vectorizes" it so you can do all the usual things with g that you want, e.g. things like
x = linspace(zmin,zmax);
y = g(x);
plot(x,y);
  1 件のコメント
Mauricio
Mauricio 2014 年 9 月 18 日
Thanks for your helped... It just worked fine.

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

その他の回答 (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