Question
MATLAB As an engineer, you are asked to calculate the approximate surface area of a lake in your local community. To do that, you decide
MATLAB
As an engineer, you are asked to calculate the approximate surface area of a lake in your local community. To do that, you decide to use a GPS to measure the x and y coordinates at various points around the lake. You pick a starting point and calibrate your GPS position at that point to be (0,0). You begin to walk around the lake collecting the following data below and eventually return to your starting position.
Upon looking at the plot above, you realise that the best way to calculate the area of the lake is to split the data into two sets, fitting a polynomial to each data set and the integrating the polynomials to approximate the area of the lake. I.e. Calculate the area above the red line and add it to the area below the red line. However, to do this, you need to determine where the polynomial crosses the red line (i.e. the root of the function) so that the limits of the integral are known.
Write an m-file which does the following:
-
Creates 2 sets of data for x [0 14] and x [14 0] with their corresponding y values. Fit 4th order
polynomials to each set of data and output the equation for each fit using fprintf.
-
Use the polynomial fit form part A to calculate the root of the polynomial that crosses zero. You
may use the fzero function.
-
Apply the Simpsons 1/3rd rule using 21 points on the polynomial above the red line.
-
Apply the Simpsons 1/3rd rule using 21 points on the polynomial below the red line. You will need
to use your result from part B here.
-
Calculate the area of a single trapezoid found above the red line between the root crossing and
x=14. This represents the excess area that needs to be subtracted.
-
Calculate the approximate area of the lake.
x 0 246 8 101214 12 10 86 420 y03 5 88.57.14.9 1.7-2.6-3.8 -6.1 -5.9 -5.2-4.10 outline of lake 10 4 -6 -9 10 12 14
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started