MATLAB: How to use matlab to find unknowns in nonlinear equation at a certain readings

fminsearchMATLABmultiple nonlinear regressionnonlinear optimizationoptimization

Hello everybody.
Assume I have the following equation: Y = a0 + a1*log(x1) + a2*log(x2) + a3*x3 + e. The unknowns here are a0, a1, a2 and a3. I need to find the values of these unknowns in order to minimize the value of error, e. Note that I have a matrix of readings such as: data = [0 5 10 15 20;1 2 3 4 5;6 7 8 9 10;11 12 13 14 15], where x1=data(1), x2=data(2), x3=data(3), and y=data(4). How can I find these unknowns using MATLAB and how can I decide that these values of unknowns are best fit or not.

Best Answer

  • Looks like a linear equation to me, linear with respect to the unknowns a0...a3, that is. Just use mldivide(). It is known to give the least squares error.