早教吧 育儿知识 作业答案 考试题库 百科 知识分享

请教matlab高手,线性拟合t=[0 1 2 3 8 10]c=[0 2 3.3 4.6 6.2 6.3]ln(Cs-c)=-Kla*t+b拟合后,把代码发过来,

题目详情
请教matlab高手,线性拟合
t=[0 1 2 3 8 10]
c=[0 2 3.3 4.6 6.2 6.3]
ln(Cs-c)=-Kla*t+b
拟合后,把代码发过来,
▼优质解答
答案和解析
t=[0 1 2 3 8 10]';
c=[0 2 3.3 4.6 6.2 6.3]';
ft_ = fittype('Cs-exp(-k*t+b)',...
'dependent',{'c'},'independent',{'t'},...
'coefficients',{'Cs', 'k', 'b'});
st=[2 1 1]
[curve, goodness]= fit(t,c,ft_,'Startpoint',st)
figure
plot(curve,'predobs',0.95);
hold on,plot(t,c,'b*')
---------
curve =
General model:
curve(t) = Cs-exp(-k*t+b)
Coefficients (with 95% confidence bounds):
Cs = 6.488 (6.059, 6.917)
k = 0.383 (0.302, 0.4639)
b = 1.876 (1.792, 1.96)
goodness =
sse: 0.0617
rsquare: 0.9980
dfe: 3
adjrsquare: 0.9966
rmse: 0.1434