Solving a system of nonlinear equations

조회 수: 1 (최근 30일)
AP
AP 2015년 7월 28일
댓글: Matt J 2015년 7월 29일
I have about 1000 measurement which relates three variables to each other: x, y, and z. In other words, I have 1000 measurement values for x, y, and z. The relationship among them is as follows:
Could someone kindly tell me how I can find the coefficients c1, c2, and c3 using MATLAB? If there were no interaction between x and y (c3=0), then c1 and c2 could be easily found by the backslash operator in MATLAB in a least square way (A\b).

답변 (1개)

Matt J
Matt J 2015년 7월 28일
편집: Matt J 2015년 7월 28일
If there were no interaction between x and y (c3=0), then c1 and c2 could be easily found by the backslash operator in MATLAB in a least square way (A\b)
Backslash should still work for least squares estimation,
x=x(:); y=y(:); z=z(:);
c = [x,y,x.*y].\z; %c=[c1;c2;c3]
although, if you have measurement noise in x and y (regardless of c3=0), some would say you should be using total least squares instead of ordinary least squares,
x=x(:); y=y(:); z=z(:);
A=[x,y,x.*y,-z];
A=bsxfun(@minus,A,mean(A,1));
[~,~,V]=svd(A,0);
c=V(1:end-1,end)./V(end);
  댓글 수: 2
AP
AP 2015년 7월 28일
Thanks. The second method (for noise), using bsxfun, yields strange results for the coefficients.
Matt J
Matt J 2015년 7월 29일
See if omitting the line
A=bsxfun(@minus,A,mean(A,1));
makes a difference.

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

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by