Fitting data to a nonlinear model to estimate parameters
1 次查看(过去 30 天)
显示 更早的评论
I am trying estimate two unknown parameters in a nonlinear model. The script that is have made works for some iterations but suddenly stops. The code is as follows:
ws; % some data with 8 columns and n rows
a = 0.0144; % constant
g = 9.81; % constant
k = 0.4; % constant
h = [30,40,50,60,70,80,90,100,106];
x0 = [100,-1];
options = optimoptions(@lsqnonlin,'Algorithm','trust-region-reflective');
for i = 1:size(ws,1)
v = ws(:,i);
fun = @(x) x(1)/k*(log(h/(a*x(1)^2/g))-x(2))-v;
x = lsqnonlin(fun,x0,[],[],options);
ustar(i) = x(1);
Psi_M(i) = x(2);
end
Is there a more effecient way of fitting the data to the model which also outputs the two unknown parameters?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!