这个很简单啊,用lsqcurvefit或者lsqnonlin都可以。比如:
function ydata = myfun(a,xdata)
ydata=xdata(:,1).*xdata(:,2).*xdata(:,3)./(a(1)*ones(size(xdata(:,1)))... +xdata(:,1))./(a(2)*ones(size(xdata(:,2)))+...
xdata(:,2))./(a(3)*ones(size(xdata(:,3)))+xdata(:,3));
x=10*rand(10,3)
y=10*rand(10,1)
a=[1,1,1]
a_final=lsqcurvefit(@myfun,a,x,y)
a_final就是结果啦。
x =
3.5166 0.7585 1.6218
8.3083 0.5395 7.9428
5.8526 5.3080 3.1122
5.4972 7.7917 5.2853
9.1719 9.3401 1.6565
2.8584 1.2991 6.0198
7.5720 5.6882 2.6297
7.5373 4.6939 6.5408
3.8045 0.1190 6.8921
5.6782 3.3712 7.4815
y =
4.5054
0.8382
2.2898
9.1334
1.5238
8.2582
5.3834
9.9613
0.7818
4.4268
a =
1 1 1
Local minimum possible.
lsqcurvefit stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.
b =
-2.3826 -0.2813 -0.2945,