Nonlinear Data-Fitting
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello everyone!
Does anybody know how to fit nonlinear Data, like in this case? Is it possible with lsqcurvefit? Thank you!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1020755/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Torsten
am 3 Jun. 2022
Bearbeitet: Torsten
am 3 Jun. 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)
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Nonlinear Least Squares (Curve Fitting) finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!