Mathematics | ![]() ![]() |
Linear-in-the-Parameters Regression
Instead of a polynomial function, we could try using a function that is linear-in-the-parameters. In this case, consider the exponential function
The unknown coefficients ,
, and
, are computed by performing a least squares fit. Construct and solve the set of simultaneous equations by forming the regression matrix,
X
, and solving for the coefficients using the backslash operator.
X = [ones(size(t)) exp(- t) t.*exp(- t)]; a = X\y a = 1.3974 - 0.8988 0.4097
The fitted model of the data is, therefore,
Now evaluate the model at regularly spaced points and overlay the original data in a plot.
T = (0:0.1:2.5)'; Y = [ones(size(T)) exp(- T) T.exp(- T)]*a; plot(T,Y,'-',t,y,'o'), grid on
This is a much better fit than the second-order polynomial function.
![]() | Polynomial Regression | Multiple Regression | ![]() |