Determining constants in an equation that have more than 3 variables
3 次查看(过去 30 天)
显示 更早的评论
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
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
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 个评论
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 Center 和 File 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!
