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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started