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

24 views (last 30 days)
woyoye
woyoye on 21 Nov 2022
Answered: fatovif on 21 Nov 2022
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 ]

Accepted Answer

fatovif
fatovif on 21 Nov 2022
可以用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
-------

More Answers (0)

Categories

Find more on 数学 in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!