Multiple integrals with limits as variables

2 次查看(过去 30 天)
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by