Nonlinear Data-Fitting

2 次查看(过去 30 天)
Anna B.
Anna B. 2022-6-3
评论: Anna B. 2022-6-10
Hello everyone!
Does anybody know how to fit nonlinear Data, like in this case? Is it possible with lsqcurvefit? Thank you!

采纳的回答

Torsten
Torsten 2022-6-3
编辑:Torsten 2022-6-3
% 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 个)

M Mirrashid
M Mirrashid 2022-6-5

类别

Help CenterFile Exchange 中查找有关 Nonlinear Least Squares (Curve Fitting) 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by