Question: The Assignment First, download the CSV file with the data that you ll work with ( see the Downloads section ) . The file you
The Assignment
First, download the CSV file with the data that youll work with see the Downloads section
The file you download, streifCourseRecords.csv contains columns of data:
The year the record was set
The time in number of seconds to the th of a second
Then you are required to do the following:
Open the streifCourseRecords.csv CSV file and read the data into a matrix
Plot the year as the Xaxis and time in seconds as the Yaxis
Title the plot, along with providing labels for the X and Y axes
Use the builtin function polyfit function to generate the coefficients of both the st and nd order polynomials that bestfit this data
Create your own function that calculates and returns the coefficients of the st order polynomial that bestfit this data
You will test your routine against MATLABs builtinthe results generated by the two routines should be the same
Print the equations for the sets of coefficients that you have produced
Use linspace to generate more data points along the Xaxis
For all sets of bestfit line coefficients:
Use polyval to generate the Yaxis coordinates corresponding to the X coordinates produced in step above
Plot the increased X coordinates from step and the Y coordinates from step a above
Add a legend for all plotted data
Describe what the plots are telling you about this data
Step : Create a BestFit Coefficients Function
As in past assignments, you are free to implement this function either as:
A subfunction contained in the script Mfile for your program
As a function implemented in a separate Mfile
You must implement the least squares formula, which generates the coefficients of a st degree polynomial that bestfits a given data set. The formula works by minimizing the squares of the differences between each data point and the line that represents all of the data points.
Recall that a st degree polynomial has the form:
and the slopeintercept formula for a straight line is the st degree polynomial:
The st degree least squares formula has two parts:
The formula for calculating the slope:
The formula for calculating the Yintercept:
where:
and
are vectors of values associated with the X and Y axes, respectively
is the length of the
or
vector
All
are
so
Note that MATLAB supports vectorized versions of all of the required functionality: sum, product, and squaring. Thus, no loops are required anywhere in your implementation.
Your function must for full credit:
Not use any loops
Generate and return the slope and Yintercept as a element vector just like ployfit does The vector returned must have the slope in outvec and the Yintercept in outvec
Step : Output the Polynomials
Example output note that these are not solutions
Output for a stdegree polynomial will look like this:
y x
And output for a nddegree polynomial:
y xx
For clarity, each of these equations should be labeled, either on the same line, or just above. Like either of these:
Linear: y x
Quadratic:
y xx
Step : Describe What the Plots Indicate
This is not a data analysis course, so do not worry about whether your answer makes sense or not. You will get credit here for the effort, not for the answer.
I would like you to produce a short statement in a word processed document using Microsoft Word or Google Docs describing what you think that the plots are indicating about this data:
Will new course record times be set on the Streif?
If so when will they be likely to be set?
If not, why not?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
