Filter löschen
Filter löschen

Can I use lsqcurvefit for a multivariable nonlinear regression

1 Ansicht (letzte 30 Tage)
Shanzida Haque
Shanzida Haque am 23 Mai 2024
Beantwortet: Matt J am 23 Mai 2024
I just wanted to ask whether the way I am using the function is correct and I can use lsqcurvefit for this type of multivariable nonlinear regression?
% Code:
initialParams_eps_2 = [0.6, 2.9, 0.5, 0.00115, 0.8, 0.0]; % initial guess for coefficients
% data taken from excel sheet:
X_2 = [p q pe_plus eps_ampl eta_av OCR];
% Model Function:
ModelFunc_3 = @(b, x) (2./sqrt(6+(1/3).*((M^2*(2.*x(:,1)-x(:,3)))./(x(:,2))))).*((x(:,4)./eps_ampl_ref).^(b(1))).*(exp(b(2).*...
(x(:,5)./M))).*(exp(-b(3).*(x(:,6)-1))).*(((b(4).*b(5))./(1+b(5).*N))+b(4).*b(6));
% Number of parameters
numParams = 6;
% Lower bounds - setting 0 for parameters with no lower bound restrictions
% lb = -inf(1, numParams); % Start with no lower bounds on any parameters
lb(1:6) = 1e-6; % Ensuring all coefficients are positive values
% Upper bounds - assuming no upper bounds are necessary
ub = inf(1, numParams); % Infinite upper bounds (no upper bound restrictions)
options_2 = optimoptions('lsqcurvefit', 'Display', 'iter', 'Algorithm', 'trust-region-reflective');
[solution_eps_2b, resnorm, residual, exitflag, output] = lsqcurvefit(ModelFunc_3, initialParams_eps_2, X_2, eps_dev_rate, lb, ub, options_2);

Antworten (1)

Matt J
Matt J am 23 Mai 2024
Yes, lsqcurvefit can be applied to problems of any dimension.

Kategorien

Mehr zu Systems of Nonlinear Equations 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!

Translated by