Multiple integrals with limits as variables
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mauricio
el 16 de Sept. de 2014
Comentada: Mauricio
el 18 de Sept. de 2014
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
0 comentarios
Respuesta aceptada
Mike Hosea
el 16 de Sept. de 2014
Editada: Mike Hosea
el 16 de Sept. de 2014
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);
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!