MATLAB integral2
The integral2 function calculates an integral with respect to two variables.
Contents
Usage
The integral2 function takes five arguments: a function handle, the bounds of integration of the outer integral, and the bounds of integration of the inner integral. Order matters because the bounds of the inner integral can reference the variable that is integrated with respect to in the outer integral, whereas the bounds of the outer integral must be a literal value.
syms theta r; % Define function with specifically ordered arguments. f = @(theta,r) (r.^2); % Define one of the bounds of integration in terms of the other variable. Order of arguments must match the above. rmax = @(theta,r) sqrt(2 - theta); % Calculate. Order of bounds of integration must match the above. integral2(f, 0,2*pi, 0,rmax);
See also integral and integral3.
