Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This question is about least squares fitting. i) Download the file lsdata.mat and load it into Matlab using for instance load 'lsdata' ii) The
This question is about least squares fitting. i) Download the file lsdata.mat and load it into Matlab using for instance load 'lsdata' ii) The file lsdata.mat contains two variables x and y. (Note that the file name is 'Isdata' and not 'Isdata', 'Is' stands for 'least squares'.) Use plot to create a figure which shows the points (x, y), 1i 1000, where x; is the ith point of the vector x and y; is the ith point of the vector y. iii) Use a least squares approach based on a polynomial of degree 4 to approximate the data points. Store the coefficients of the polynomial in the column vector z, where the polynomial is given by z(1) + z(2)x + z(3)x+z(4)x + z(5)x (here, z(i) is the ith entry of z). iv) Plot the least squares approximation in the same figure as the data points. v) Compute the error of the approximation using the 2-norm. Store the result in the variable Iserr. (Note that it is 'Iserr' and not 'Iserr', it stands for 'least squares error'.) vi) Use fprintffprint to print a suitable statement and the value of Iserr. Note: Do not use 'clear', 'clc', 'close' in your code as this can interfere with Matlab grader. check x check y check vector z Iserr using plot using fprintf
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