This function takes in input data x and y, and outputs the coefficients Z of a cubic polynomial that best fits the data using the method of least squares. It calculates the matrix A and vector D needed to solve the normal equations AZ=D, inverts A to solve for Z, then defines an anonymous function Y to evaluate the cubic polynomial using the coefficients Z. It plots the input data and fitted cubic curve on the same graph.
This function takes in input data x and y, and outputs the coefficients Z of a cubic polynomial that best fits the data using the method of least squares. It calculates the matrix A and vector D needed to solve the normal equations AZ=D, inverts A to solve for Z, then defines an anonymous function Y to evaluate the cubic polynomial using the coefficients Z. It plots the input data and fitted cubic curve on the same graph.
This function takes in input data x and y, and outputs the coefficients Z of a cubic polynomial that best fits the data using the method of least squares. It calculates the matrix A and vector D needed to solve the normal equations AZ=D, inverts A to solve for Z, then defines an anonymous function Y to evaluate the cubic polynomial using the coefficients Z. It plots the input data and fitted cubic curve on the same graph.