Question: Task 2 ( 1 7 points ) A student collected data from a tensile testing experiment ( load in Newtons as a function of time
Task points
A student collected data from a tensile testing experiment load in Newtons as a function of time in
seconds but there was electronic noise in the load cell used to record the data. The recorded data is
available in noisy lsx
The student needs to smooth the data using a leastsquares approach. In this case, there is a polynomial
relationship between and values, but it is clear that the relationship is not linear.
Week Assignment
Introduction to Structured Programming MAE
Due Sunday, May : pm for all sections
The builtin MATLAB function, polyfit, will determine values of vector that will fit a polynomial of a
specified order using a leastsquares approach to data given as and vectors, where the general form
of a polynomial of order approximating the data is:
cdots
Once has been determined, a vector can be determined, which gives the values of approximated
using an order polynomial, using the builtin MATLAB function, polyval.
For instance, a order polynomial is given as:
See the MATLAB help for polyfit and polyval.
Write MATLAB code to approximate the data for the student, as described below.
Include comments explaining your code.
The main function should call a subfunction to read the data using readtable from the provided
spreadsheet file.
The main function should call a second subfunction to approximate the data using polynomials of
orders using polyfit and polyval
Output a plot containing the original data plotted with black circles with a marker size of and a
linewidth of Superimpose plots of the approximated load values for polynomials of order
using lines with a linewidth of and different colors for each polynomial order. Set the and axes
limits so that data points are not located on the edge of the plot. Create a legend with labels for
the original data and the approximated values, specifying the polynomial order for each color line.
Label the and axes appropriately include unitsMake sure the legend is positioned where it
doesn't cover any data.
For extra credit, create a second plot showing the errors associated with each polynomial. Plot
the values of vs Use dots of different colors for each polynomial matching the colors
for polynomial order in the first plot The plot symbols should have a marker size of Provide
appropriate labels for the and axes, create a legend with labels for polynomial order, and include
an appropriate plot title with a fontsize of Make sure the legend is positioned where it doesn't
cover any data.
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
