Question
1. Least Squares Fit to a Data Set by a Linear Function The following nine data points are nearly linear and can be approximated by
1. Least Squares Fit to a Data Set by a Linear Function
The following nine data points are nearly linear and can be approximated by a linear function .
X | -1.0 | 0.0 | 2.1 | 2.3 | 2.4 | 5.3 | 6.0 | 6.5 | 8.0 |
Y | -1.02 | -0.52 | 0.55 | 0.70 | 0.70 | 2.13 | 2.52 | 2.82 | 3.54 |
Enter the x and y coordinates of the data points as column vectors and respectively.
Set
Compute the least squares solution to the linear system using the method developed in class.
Suggestion: Set and . then will equal the last column of .
and then
Now try out the MATLAB \ operation which will do all the work for you and return the least squares solution automatically.
To see your least squares line graphically, set
and
then plot the original data points and the least squares linear fit, using the MATLAB command
x .
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