Search for question
Question

Problem 2:Write a MATLAB M-file that uses the general least squares method (y = Zā ) to fit the following data with a multiple linear regression equation of the form

y=ao+a_{\mathrm{l}}x_1+a_2x_2\colon The M-file should solve the normal equation based on Z for the model coefficient a, i.e. \left[\mathrm{Z}^{\mathrm{T}} \mathrm{Z}\right](\vec{a})=\left\{\mathrm{Z}^{\mathrm{T}} \vec{y}\right\} Provide a printout of your M-file and a printout of the command window showing your results. Write down the best-fit equation and put a box around it.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6