What tool to use to perform Nonlinear Regression with more than 3 variables?
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
M.Abuasbeh
am 13 Mai 2015
Kommentiert: Ruby Wei
am 21 Jun. 2020
Hi
I am trying to perform a nonlinear regression in Matlab. I have one dependent variale (response) and 16 independent variables (predictors). I am trying to find any tool in Matlab that can perform the nonlinear regression or curve fitting for all of them together.
Is there any such tool in Matlab?
1 Kommentar
Akzeptierte Antwort
Star Strider
am 13 Mai 2015
The nlinfit function will do what you want.
The procedure for having multiple independent variables is not quite obvious, but easy enough to do. The nonlinear fitting functions will only take one argument for the independent variable, but that argument can be a matrix. To do a nonlinear regression with multiple independent variables, combine your different independent variables into a matrix, and pass that to nlinfit.
For example:
% EQUATION: y = exp(q*x1) * sin(r*x2)
% MAPPING: b(1) = q, b(2) = r, x(:,1) = x1, x(:,2) = x2
x = [x1(:), x2(:)];
f = @(b,x) exp(b(1).*x(:,1)) .* sin(b(2).*x(:,2));
B0 = [1; 1];
B = nlinfit(x, y, f, B0);
(Note: Untested code, for illustration purposes only!)
1 Kommentar
Ruby Wei
am 21 Jun. 2020
What if two indepent variables have different dimansions? In this case, they can't be combined into one matrix.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Regression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!