Question: MATLAB PRACTICE EXAM - PROBLEM 3 : The area of a closed polygon can be computed from the coordinates of the polygon's vertices. If the

MATLAB PRACTICE EXAM - PROBLEM 3: The area of a closed polygon can be computed from the coordinates of the polygon's vertices. If the points are (x1,y1),(x2,y2),dots,(x4,y4), then here's the formula:
2A=(x1y2-x2y1)+(x2y3-x3y2)+(x3y4-x4y3)+(x4y1-x1y4)
Notice the formula is for 2 times the area - to get the area, calculate the number on the right and divide it by 2. Also, the number you get will depend on whether you go clockwise or counter-clockwise around the polygon. One direction will give the negative of the other, so to get the actual area, find the area as above and then take the absolute value.
Write a function in a MATLAB m.file to determine the area of a closed polygon using this method. The input parameters must be the vectors x and Y with the coordinates of the polygon's vertices, and the output the area enclosed by these points. Notice that this method can be used to estimate irregular closed areas if the boundary coordinates are known.
Download the Excel file DataMATLAB darr and save it in your MATLAB current folder.
For each zone in the file, do the following:
a) Create a scatter plot in MATLAB with the x and y coordinates to visualize the area.
b) Call your function from the live script file to determine the area of the zone.
c) Compare your result with the one given by the MATLAB function trapz.
SAVE YOUR LIV SCRIPT FILE
MATLAB PRACTICE EXAM - PROBLEM 3 : The area of a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!