Non-linear Regression analysys with two input variables

1 view (last 30 days)
I would like to obtain a regression parameters for the following case:
y=f(X1, X2)
Relationship between y and X1,X2 are non-linear. The equation might be as follows:
y=a1*X1+a2*X2+a3*X1^a4+X2^a5+a6
Could you please advise, how I can get the following information using matlab: 1. Optimum structure of regression equation 2. optimum regression parameters
入力変数(独立変数)2個で、従属変数1個のデータがあり、従属変数をこれら2個の独立変数の関数として表現したいのですが、そのやり方をご教示願います。 従属変数とこれら2個の独立変数の関係は、非線形です。

Answers (1)

Star Strider
Star Strider on 3 Sep 2014
The nonlinear regression routines will only allow one input for the independent variable, but the independent variable can be a matrix.
For your hypothetical equation, you would evaluate it as:
Yfcn = @(a,X) a(1).*X(:,1) + a(2).*X(:,2) + a(3).*X(:,1).^a(4) + X(:,2).^a(5) + a(6);
with X being an (Nx2) matrix, Y being a (Nx1) vector, and a being a (6x1) vector.
The call to nlinfit would be:
aest = nlinfit(X, Y, Yfcn, a0)
and if you chose lsqcurvefit:
aest = lsqcurvefit(Yfcn, a0, X, Y)
with a0 being your initial parameter estimates, and aest being the vector of estimated parameters.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!