Differences between revisions 2 and 3
Revision 2 as of 2025-12-17 21:12:43
Size: 1045
Comment: Typo and link
Revision 3 as of 2026-01-05 17:11:02
Size: 1067
Comment: Link
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The '''`integral2`''' function calculates an integral with respect to two variables. The '''`integral2`''' function calculates an [[Calculus/Integral|integral]] with respect to two variables.

MATLAB integral2

The integral2 function calculates an integral with respect to two variables.


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.


CategoryRicottone

MATLAB/Integral2 (last edited 2026-01-05 17:11:02 by DominicRicottone)