Question: Note: The units should be in SI. Make the use of both user-defined and built- in MATLAB functions as well as the conditional statements in
Note: The units should be in SI. Make the use of both user-defined and built- in MATLAB functions as well as the conditional statements in your program. P1 (20%). Figure 1 shows the geometry formulas for common 2D shapes. Write a MATLAB program that ask the user about the shape, as well as corresponding parameters and calculate the area. SQUARE * = side Area: A = Perimeter: P = 48 CIRCLE r=radius, d = diameter Diameter: d=2r Area: A Circumference C = 2 = RECTANGLE 1 = length, w = width Area: A=Ine Perimeter: P = 21+ 2 SECTOR OF CIRCLE r = radius, 8 = angle in radians Are A = 10r? Are Length: * = r TRIANGLE b = base, h = height Ara: A = 4th Perimeter: P =a + b + c ELLIPSE mimjor axis b = cmiminor axis Aren: A = *ab Circumference C** (3(a + b) - Via +3h)(b + 3a)) EQUILATERAL TRIANGLE side Height: h= Are A=4 ANNULUS r=inner radius, R outer radius Average Radius: p= $(r + R) Widthew R- Area: A = *(R? - ) or A = 2 PARALLELOGRAM b = buse, h = height, a = wide Area: A = We Perimeter: P =2a + 20 TRAPEZOID 0,b=besh = height: cd-sites Area A a +b) Perimeter P=a+b+e+ REGULAR POLYGON * = side length mamber of sides Circumradius: R = sce() Area: A = inco ) or A = Rsin()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
