24小时热门版块排行榜    

CyRhmU.jpeg
查看: 6997  |  回复: 21
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

yupeifeng

金虫 (小有名气)

[交流] matlab求解方程中的参数已有4人参与

搞了这么久还是没有解决这个问题。现在求助于高手给予指点。谢谢了!!
实验数据为:(t,c)=(0,0.69)(2,0.645)(4,0.635)(8,0.62)(24,0.61)(48,0.61).其中t为时间,c为某离子的浓度。
动力学方程模型为:-dc/dt=k*(c0-c)^(1/3)*(c-c~).
其中c0为初始浓度可以取0.7,c~为平衡浓度取0.61.
怎么样才能拟合出参数k的值呢?谢谢大家给出程序代码,再次感谢
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

憧憬未来
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dingd

铁杆木虫 (职业作家)

★ ★ ★
小木虫: 金币+0.5, 给个红包,谢谢回帖
fegg7502: 金币+2, 多谢交流 2012-07-09 08:07:55
1stOpt求解:
CODE:
Constant c0=0.7,cp=0.61;
Variable t,c;
ODEFunction c'=-k*(c0-c)^(1/3)*(c-cp)
Data;
t,c
0,0.69
2,0.645
4,0.635
8,0.62
24,0.61
48,0.61

均方差(RMSE): 0.00535058522113925
残差平方和(SSE): 0.000143143811043369
相关系数(R): 0.955733024504782
相关系数之平方(R^2): 0.913425614129058
决定系数(DC): 0.852429060780033

参数                  最佳估算
--------------------        -------------
k        1.02159845408008
5楼2012-07-03 08:52:49
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 22 个回答

dbb627

荣誉版主 (著名写手)

★ ★ ★ ★ ★
小木虫: 金币+0.5, 给个红包,谢谢回帖
fegg7502: 金币+4, 多谢交流 2012-07-09 08:07:15
这个其实论坛里有很多例子,参考就能写出来。
给你写了个
CODE:
function parafit
clear all;
t=[0 2 4 8 24 48];
y=[0.69 0.645 0.635 0.62 0.61 0.61];
y0=0.69;

% Nonlinear least square estimate using lsqnonlin()
beta0=0.5;
lb=[0];ub=[inf];
[beta,resnorm,residual,exitflag,output,lambda,jacobian] = ...
    lsqnonlin(@Func,beta0,lb,ub,[],t,y,y0);         
ci = nlparci(beta,residual,jacobian);
beta;
% result
fprintf('\n Estimated Parameters by Lsqnonlin():\n')
fprintf('\t k = %.4f ± %.4f\n',beta(1),ci(1,2)-beta(1))
fprintf('  The sum of the residual squares is: %.1e\n\n',sum(residual.^2))

% plot of fit results
tspan = [0  max(t)];
[tt yc] = ode45(@ModelEqs,tspan,y0,[],beta);
tc=linspace(0,max(t),200);
yca = spline(tt,yc,tc);
plot(t,y,'ro',tc,yca,'r-');
hold on
xlabel('Time');
ylabel('Concentration');
hold off
% =======================================
function f1 = Func(beta,t,y,y0)        % Define objective function
tspan =t;
[tt yy] = ode45(@ModelEqs,tspan,y0,[],beta);
yc= spline(tt,yy,t);
f1=y-yc;
% ==================================
function dydt = ModelEqs(t,y,beta)          % Model equations
dydt = -beta*(0.7-y).^(1/3)*(y-0.61);

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2012-07-02 17:38:01
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

★ ★ ★ ★
fegg7502: 金币+4, 应助指数+1, 专家考核, 多谢交流 2012-07-09 08:07:38
结果如下
Local minimum possible.

lsqnonlin stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.




Estimated Parameters by Lsqnonlin():
         k = 1.0138 ± 0.3000
  The sum of the residual squares is: 1.5e-004


The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
3楼2012-07-02 17:39:27
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yupeifeng

金虫 (小有名气)

引用回帖:
3楼: Originally posted by dbb627 at 2012-07-02 17:39:27
结果如下
Local minimum possible.

lsqnonlin stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.

< ...

首先感谢这位 学长啊,我有点看不懂啊,你帮我 分析下思路,步骤是什么?就是先做设么计算,
憧憬未来
4楼2012-07-02 22:01:21
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
普通表情 高级回复(可上传附件)
信息提示
请填处理意见