Given a data table with values of x and y and supposed to approximate relationship between x and y. The first case is a parabola with equation y = a0 + a1*x + a2*(x^2)
and the second case is a saturation growth rate equation with the equation y = a0*(x/(a1+x)). Must find the parameters using normal equations formulation of least squares.
Finished the code for the parabola and it is the following
x = [20 40 60 80 100 120 140 160]; y = [13 22 30 36 40 43 45 46]; A = [ones(size(x))' x' (x.^2)'];b = inv(A'*A)*(A'*y');s = b(3)*x.^2+b(2)*x+b(1);plot(x,s,'k')hold off
How can you modify code for it to run for saturation growth rate equation?
Best Answer