|
function A=area_ellipse(a, b) % area_ellipse computes the area of an ellipse. % Arguments a and b correspond to half the % short and long axes. % If only one argument is passed, then a and b % are assumed to be equal to that argument, % and effectively the area of a circle is % computed.
error(nargchk(1, 2, nargin))
if (nargin == 1) b=a; end
if ((a < 0) || (b < 0)) A=0; else A=pi*a*b; end
|
|
Figure 4.19 Click to enlarge
|
|