How can I obtain two unknown with one equation through optimization?

1 次查看(过去 30 天)
Hi, I have one equation with two unknowns(A and y) as follows;
ls/D=A [Jg+(y^2/Jg)] input parameters are: D=0.04; Jg and ls are vectors as;
Jg=[0.574 0.765 0.957 1.148 1.340 1.531 1.722 1.914 2.10]; ls=[0.298 0.304 0.341 0.434 0.473 0.504 0.542 0.559 0.594];
any help would be appreciated.

回答(1 个)

John D'Errico
John D'Errico 2016-7-7
编辑:John D'Errico 2016-7-7
You do not have ONE equation. You have a set of points, and an equation that relates them, for some unknown set of parameters, A and y. So you can think of this as many equations, with two unknowns.
The technique that is used to solve for those unknown parameters is called curve fitting. In fact, you can (logically) use the curve fitting toolbox. Or you can use tools like lsqnonlin or lsqcurvefit, from the optimization toolbox. Or nlinfit from the stats toolbox.
mdl = fittype('A*(Jg+(Y^2/Jg))','coeff',{'A','Y'},'indep','Jg');
>> res = fit(Jg',ls'/D,mdl)
Warning: Start point not provided, choosing random start point.
> In curvefit.attention.Warning/throw (line 30)
In fit>iFit (line 299)
In fit (line 108)
res =
General model:
res(Jg) = A*(Jg+(Y^2/Jg))
Coefficients (with 95% confidence bounds):
A = 7.003 (6.436, 7.571)
Y = 0.5455 (0.419, 0.672)
>> res.A
ans =
7.0034
>> res.Y
ans =
0.54553

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by