Question: 3) Write a completely generic function to fit a polynomial to a data set (x,y) with the following format: function [A,r] = polynomial_regression(x,y,m,plot_logical) where A,
3) Write a completely generic function to fit a polynomial to a data set (x,y) with the following format: function
[A,r] = polynomial_regression(x,y,m,plot_logical)
where A, r and m are the vector of polynomial coefficients, the correlation coefficient, and the order of the polynomial, respectively. This function should calculate the vector of polynomial coefficients (A) by solving the normal equations written in matrix form [M](A) = (V) for a given order m. This is a generalization of equations (5) in my notes, which are the normal equations for quadratic interpolation (case m = 2). For a given m, the function should generate the matrix [M] and the vector (V) (you are allowed a maximum of 2 FOR loops for their creation), and solve for (A) using the left matrix divide command (look it up if you are not familiar with it).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
