知道函数的初始和目标状态,如何用matlab求解带未知数的系数函数表达式
发布网友
发布时间:2022-05-15 09:07
我来回答
共1个回答
热心网友
时间:2023-10-17 00:48
您好,t=[0.1,1.1,2.3,3.4,4.5,5.7,6.7]';
y=[0,94.0,84.0,77.0,69.0,62.0,56.0]';
ft_ = fittype('A*exp(-beta*t)*cos(w*t+phi)',...
'dependent',{'y'},'independent',{'t'},...
'coefficients',{'A', 'beta', 'phi', 'w'});
st=[-100 0.01 -pi 5]
[curve, goodness]= fit(t,y,ft_,'Startpoint',st)
figure
plot(curve,'predobs',0.95);
hold on,plot(t,y,'b*')
st =
-100.0000 0.0100 -3.1416 5.0000
curve =
General model:
curve(t) = A*exp(-beta*t)*cos(w*t+phi)
Coefficients (with 95% confidence bounds):
A = -143.8 (-219.6, -68.05)
beta = 0.135 (0.01584, 0.2541)
phi = -2.131 (-2.379, -1.883)
w = 5.394 (5.259, 5.529)
goodness =
sse: 352.1786
rsquare: 0.9377
dfe: 3
adjrsquare: 0.8754
rmse: 10.8348