用matlab最小二​乘法拟合非线性函数,​有约束条件,无初始值​。

24 次查看(过去 30 天)
woyoye
woyoye 2022-11-21
回答: fatovif 2022-11-21
matlab最小二乘法拟合非线性函数,a,b,d满足最小二乘函数在约束条件b+d-bd>1达到最小时,a,b,d但是a,b,d的初始值未知,还可以求出来吗?应该怎么求解呢?T-T matlab小白,才开始学这个软件。。。
C(t)=a*e(-bt)-a*e(-dt)
t=[1 6 12 18 24 30 36 42 48 54 60 66 72]
C(t)=[0.093 0.064 0.058 0.055 0.053 0.050 0.044 0.043 0.042 0.040 0.039 0.039 0.038 ]

采纳的回答

fatovif
fatovif 2022-11-21
可以用fmincon。
t=[1 6:6:72];
c=[0.093 0.064 0.058 0.055 0.053 0.05 0.044 0.043 0.042 0.04 0.039 0.039 0.038];
function [c,ceq] = mycon1104(x)
c = 1-x(2)-x(3)-x(2)*x(3);
ceq = [];
end %约束函数,作为m文件
x = fmincon(@(x) fun(x),rand(1,3),[],[],[],[],[],[],@(x) mycon1104(x))
得到x,可能是指数函数的原因,比较难找到最优值,或者可能在很多点都可以达到。
x =0.0754 0.0121 7.6007
fun(x)=5.8530e-04
x = -0.0754 65.6695 0.0122
fun(x)= 5.8390e-04
-------

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 数学 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!