How to do parameter fitting for a system of equations with 3 independent variables?

조회 수: 4 (최근 30일)
I have a system of 3 equations with 3 independent variables( x1,x2,x3) and correspondingly 3 dependent variables( y1,y2,y3) as follows:
  • y1=((b1*x1)/(1+(b1*x1)+(b2*x2)+(b3*x3))) + ((b4*x1)/(1+(b1*x1)+(b2*x2)+(b3*x3)));
  • y2=((b2*x2)/(1+(b1*x1)+(b2*x2)+(b3*x3))) + ((b5*x2)/(1+(b1*x1)+(b2*x2)+(b3*x3)));
  • y3=((b3*x3)/(1+(b1*x1)+(b2*x2)+(b3*x3))) + ((b6*x3)/(1+(b1*x1)+(b2*x2)+(b3*x3)));
x and y data are available.
I need to fit 6 parameters( b1,b2,b3,b4,b5,b6) in this system.
I tried using nlinfit but couldn't make it work for this case. Suggest me how to solve this problem. Thank you.

채택된 답변

Torsten
Torsten 2015년 8월 18일
편집: Torsten 2015년 8월 18일
xdata = horzcat(x1,x2,x3);
ydata = horzcat(y1,y2,y3);
fun=@(b,xdata) horzcat((b(1)+b(4))*x1./(1+b(1)*x1+b(2)*x2+b(3)*x3),(b(2)+b(5))*x2./(1+b(1)*x1+b(2)*x2+b(3)*x3),(b(3)+b(6))*x3./(1+b(1)*x1+b(2)*x2+b(3)*x3));
b0=[1 ; 1 ; 1 ; 1 ; 1 ; 1];
[x,resnorm] = lsqcurvefit(fun,b0,xdata,ydata);
Best wishes
Torsten.
  댓글 수: 1
Amaya
Amaya 2017년 5월 25일
I tried doing this on a similar problem and the extimated x output changes with the initial guess, even when setting a very low tolerance:
% code
opts = optimset('TolX',1e-15);
[vestimated,resnorm] = lsqcurvefit(fun,x0,xdata,ydata,[],[],opts);%
how does lsqcurvefit pass x1,x2 and x3 into fun?, shouldn't fun be expressed in terms of
xdata(initial_index:final_index).
rather than in terms of x1,x2 and x3?
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Balan
Balan 2015년 8월 18일
Works perfect. Thanks a lot Torsten.

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by