How to fit custom equation in a linear regression?
5 views (last 30 days)
cr on 18 Nov 2022
Edited: cr on 18 Nov 2022
Presuming you are trying to estimate a1, a2, a3 you can just to a lmdivide. You will need data for x & y with atleast 3 to solve (and 4 for a linear regression).
e.g. with the n observations, you will have n equations a1 + a2xi^4 + a3xi^5 = yi
A = X\Y
where A is the 3 x 1 vector of unknowns a1 a2 a3
X is n x 3 matrix of observations x1, x2, x3,...xn
[1 x1^4 x1^5;
1 x2^4 x2^5; ....;
1 xn^4 xn^5]
Y is n x 1 vector