Question: Using Matlab Create a least-squares function called least_squares.m that accepts a Z-matrix and dependent variable y as input and returns the vector of best-fit constants,
Using Matlab

Create a least-squares function called least_squares.m that accepts a Z-matrix and dependent variable y as input and returns the vector of best-fit constants, a, the best-fit function evaluated at each point f(x_i), and the coefficient of determination, r2. [a, fx, r2]=least_squares(Z, y); Test your function on the sets of data in script problem_1_data.m and show that the following functions are the best fit lines: a. y=0.3745+0.98644x+0.84564/x b. y=-11.4887+7.143817x-1.04121 x 2+0.046676 x 3 c. y=4.0046e (-1.5x)+2.9213e (-0.3x)+1.5647e (-0.05x) Create a least-squares function called least_squares.m that accepts a Z-matrix and dependent variable y as input and returns the vector of best-fit constants, a, the best-fit function evaluated at each point f(x_i), and the coefficient of determination, r2. [a, fx, r2]=least_squares(Z, y); Test your function on the sets of data in script problem_1_data.m and show that the following functions are the best fit lines: a. y=0.3745+0.98644x+0.84564/x b. y=-11.4887+7.143817x-1.04121 x 2+0.046676 x 3 c. y=4.0046e (-1.5x)+2.9213e (-0.3x)+1.5647e (-0.05x)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
