Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the least-squares of general linear regression (the matrix method) to fit th

ID: 3290030 • Letter: U

Question

Use the least-squares of general linear regression (the matrix method) to fit the data in the table to the following function: y = ax + b/x^2 where a and b are two fitting parameters. You are asked to do following: a) Define the two z functions, z_0(x) and z_1(x), so that Eq. (3) can be formatted into a general linear equation, y = a_0 z_0(x) + a_1 z_1(x) b) Develop the numerical algorithm of the general linear regression (i.e., the matrix method) based on the principle of least squares of the residues. c) Write down the following z and y matrix of the algorithm, ([z]^T [z]){a} = ([z]^T {y}) d) Develop a MATLAB code to implement the algorithm for the two constant a and b in Eq. (3) for the given data. e) The code should also include the calculation of the correlation coefficient R: R = squareroot S_t - S_r/S_t.

Explanation / Answer

a) z0(x) = x ,z1(x) = 1/x^2

b) {a} = [a;b]

Z = [ z0(x1) z1(x1);   z0(x2) z1(x2); ...  z0(xn) z1(xn); ]

y =[y1;y2; ...yn];

{a} = ({z}Tz )-1 {z}Ty

c) z = [0.8 1/0.8^2 ; 1.6 1/1.6^2 ; 2.4 1/2.4^2 ; ; 3.2 1/3.2^2 ; 4 1/4^2 ];

y = [6;3.6;4.1;5.1;6.2];

d)

a = (inv(z'*z ))*z'*y

a =

1.4987
3.0714

hence a = 1.4987 , b = 3.0714

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote