Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Fitting a curve to your data in MATLAB can show trends and estimate values not included in the data set. In this problem, you will
Fitting a curve to your data in MATLAB can show trends and estimate values not included in the data set. In this problem, you will use MATLABs builtin polynomial curve fitting functions to determine the best equation for the data given in the Excel file swingDataxlsx
a Read the Excel file swingDataxlsx into the Workspace and call it swingData this must be done using a function in your mfile
i The first column of swingData is the time in seconds incremented from to Save this column as a separate variable called Time.
ii The second column of swingData is the swing height at different time increments. Save this column as a separate variable called yPosition.
b Using the polyfit function in MATLAB, find the bestfit coefficients for the given data in swingData. Call the output of the polyfit function coeffs. Test different order polynomials in the polyfit function to find the bestfit curve for the data.
c Create an equation using the coefficients in coeffs this should be done by referencing the values from coeffs Call this equation yEqn.
d Calculate how well your equation fits the given data points using the sum of squared errors method. Call the output SSEyEqn. Refer to your lecture slides if you dont remember.
i Is the value high or low? What does that value tell you about your equation? Write your answer as a comment inside your mfile.
e Using the polyval function in MATLAB, find the swing height at seconds if the swings motion were to follow your equation. Assign the output to Height.
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