Determining constants in an equation that have more than 3 variables

조회 수: 3 (최근 30일)
Can Ekici
Can Ekici 2016년 8월 29일
댓글: Star Strider 2016년 9월 4일
I am new in Matlab. I have following equation and want to find best a, b, c, d constants.
u=q*(a*(1-exp(z^b))+c*(z*y)+d*z)
y, z, q, u are known variables, there are 1600 values for each variable and I have got these value sets in Excel format. I can import these data from Excel.
  댓글 수: 1
Star Strider
Star Strider 2016년 9월 4일
This is a slightly different presentation of a similar equation in I want to find constants in an equation that has got many parameters earlier today. (It should have been phrased ‘I want to estimate 3 parameters in a equation with 4 dependent variables and 1 independent variable’.) With four days separating them, I wasn’t aware of the near-duplication.

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 8월 29일
You can use the Curve Fitting Toolbox with a custom equation. If you have that toolbox, invoke cftool, choose x, y, and z on the left, choose Linear Fitting, and input your equation.
  댓글 수: 7
Can Ekici
Can Ekici 2016년 9월 1일
편집: Can Ekici 2016년 9월 2일
I found the edit menu but it added new coefficients like a. b. c. d. e... But I cannot solve my equation with that menu. I want to add new variables like x, y, z, not constants like a, b, c. My known variables are y, z, q, u. So, I am trying to find a, b, c, d coefficients in equation u=q*(a*(1-exp(z^b))+c*(z*y)+d*z). I have got 1600 lines y, z, q, u values in Excel format. I want to find best a, b, c and d those fit the equation.
Walter Roberson
Walter Roberson 2016년 9월 3일
If I recall correctly, the Curve Fitting Toolbox is only able to handle 3 input variables, and to get even 3 you have to combine two of them in a way that is not obvious (but is documented.)
You will therefore need to convert your fitting into a minimization, probably either fmincon() or fminsearch()
When using the Curve Fitting Toolbox tools, the objective function needs to be the residues, and the toolbox will calculate the least-squares fit. When using fmincon() or fminsearch() the objective function needs to be the sum-of-squares of the residues.
The basic idea is that the best fit is the one for which the sum-of-squares of the residue is smallest.
If you were using one of the more standard curves, the curve fitting process might be able to take advantage of some provable properties of the fit to figure out where to search and how to know when to end. As you are not, though, the search can end up being dumb, and is pretty likely to get caught in local minima. The exp(z^b) term pretty much guarantees that it will mostly get caught in local minima.
If any of your z values are negative then your expressions are going to become complex-valued (because your b is not restricted to integers) and the sum-of-squares-of-residues becomes a dubious measure.

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

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by