The area of the circular crown is given by the following formula: pi * (r2^2 - r1^2)
Question:
The area of the circular crown is given by the following formula:
pi * (r2^2 - r1^2)
where r1 and r2 are the inner and outer radius, respectively.
Write a function in MATLAB called calc_crown_area that will receive pairs of lengths of radii as input arguments, and
will return the areas of the crowns. The function should work when the inputs are a pair of single values, i.e. one scalar for the inner radius and one scalar for the outer
radius. In this case, the function will return one single output for the area. the inputs are a pair of vectors, i.e. one vector of inner radii (R1) and a corresponding vector of outer radii (R2), of the same length n. In this case the function will return n values for the areas where each is calculated as pi * (R2i^2 – R1i^2) for each i ≤ n. For this case, your code needs to handle
the user error when the two vectors provided as inputs do not have the same length.your code needs to handle the user error when r1 > r2 for both scalar and vector inputs.
Microeconomics
ISBN: 978-1464187025
2nd edition
Authors: Austan Goolsbee, Steven Levitt, Chad Syverson