Question: Develop a Matlab function myCubicFit that calculates the coefficients a 0 through a 3 of the cubic polynomial f ( x ) = a 0

Develop a Matlab function myCubicFit that calculates the coefficients a0 through a3 of the cubic polynomial f(x)=
a0+a1x+a2x2+a3x3 that best fits given data points (xi,yi). The input arguments to the function must be the two
vectors x and y that contain the values of the data points. The output of the function shall be a four-element column
vector a that contains the values of a0 through a3, and the error of the fit E defined as the sum of the squares of the
residuals. Do NOT use any Matlab build-in functions to solve the required system of linear equations. Instead use
myGaussJordan from Module 2. Use Matlab's 'operator to calculate the transpose of a matrix and * to calculate the
product of matrices. Inside the function check that the length of the vectors x and y is the same. If not, display an
error message, set the vector a and E to realmax() and exit the function.
 Develop a Matlab function myCubicFit that calculates the coefficients a0 through

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 Databases Questions!