Nonlinear Data-Fitting

3 vues (au cours des 30 derniers jours)
Anna B.
Anna B. le 3 Juin 2022
Commenté : Anna B. le 10 Juin 2022
Hello everyone!
Does anybody know how to fit nonlinear Data, like in this case? Is it possible with lsqcurvefit? Thank you!

Réponse acceptée

Torsten
Torsten le 3 Juin 2022
Modifié(e) : Torsten le 3 Juin 2022
% Prescribe arrays
K = ...;
X = ...;
L = ...;
Y = ...;
% Define function
fun = @(a,b,c,d,h) K.*log(a./(a-X)) + K/b.*log(X/c) + (d+L*h).*X - Y;
% Define initial values for a,b,c,d,h
a0 = ...;
b0 = ...;
c0 = ...;
d0 = ...;
h0 = ...;
% Call the optimizer
p = lsqnonlin(@(p)fun(p(1),p(2),p(3),p(4),p(5)),[a0,b0,c0,d0,h0]);
% Output fit parameters
a = p(1)
b = p(2)
c = p(3)
d = p(4)
h = p(5)
  1 commentaire
Anna B.
Anna B. le 10 Juin 2022
thank you very much!

Connectez-vous pour commenter.

Plus de réponses (1)

M Mirrashid
M Mirrashid le 5 Juin 2022

Catégories

En savoir plus sur Nonlinear Least Squares (Curve Fitting) dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by