(Least Squares Fit to a Data Set by a Linear Function) The following table of x and y

Chapter 5, Problem 2

(choose chapter or problem)

(Least Squares Fit to a Data Set by a Linear Function) The following table of x and y values was given in Section 5.3 of this chapter (see Figure 5.3.3). 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 The nine data points are nearly linear and hence the data can be approximated by a linear function z = c1x + c2. Enter the x and y coordinates of the data points as column vectors x and y, respectively. Set V = [ x, ones(size(x))] and use the MATLAB \ operation to compute the coefficients c1 and c2 as the least squares solution to the 9 2 linear system Vc = y. To see the results graphically, set w = 1 : 0.1 : 8 and z = c(1) w + c(2) ones(size(w)) and plot the original data points and the least squares linear fit, using the MATLAB command plot(x, y, x, w, z)

Unfortunately, we don't have that question answered yet. But you can get it answered in just 5 hours by Logging in or Becoming a subscriber.

Becoming a subscriber
Or look for another answer

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back