|
|
★ dubo(金币+1): 谢谢参与 2011-06-13 19:31:05
你好,我用重新参考别人写的程序,用数值解求参数,程序写的很繁琐,你能帮我改改吗?另外,现在运行不下去,提示说divided by zero.你能给看看,怎样把数据处理就能好些?
S=dsolve(‘Dy=-k1*y*214.63/(y+k2)’,’y(0)= 255.55’)
simplify(S) %微分方程积分,求出来式子相当繁琐
function monodfit2
clear all;
t= [0 2 7 9 19 22 24 26 28 30 32 40]’;
c=[255.55 246.44 237.28 228.36 136.08 114 99.16 82.33 69.4 56.94 42.31 0]’;
[y_row,y_col]=size(c);
beta0=[0.03,0.3];
c0=255.55;
lb=[0 0];ub=[inf inf];
[beta,resnorm,residual,exitflag,output,lambda,jacobian] = ...
lsqnonlin(@seqfun,beta0,lb,ub,[],t,c,y_col,c0);
ci = nlparci(beta,residual,jacobian);
function y = seqfun(beta,t,c,y_col,c0) % Objective function
tspan = [0 max(t)];
[tt yy] = ode45(@modeleqs,tspan,c0,[],beta);
for col = 1:y_col
yc(:,col) = spline(tt,yy(:,col),t);
end
y=[c(:,1)-yc(:,1)];
function dydt = modeleqs(t,y,beta) % Model equation
dydt=beta(2)*lambertw(1/beta(2)*exp(-1/100*(21463*t*beta(1)-25555-100*beta(2)*log(19)-100* beta(2)*log(269)+200* beta(2)*log(2)+100* beta(2)*log(5))/ beta(2))); |
|