24小时热门版块排行榜    

查看: 7666  |  回复: 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的回帖

yupeifeng

金虫 (小有名气)

引用回帖:
5楼: Originally posted by dingd at 2012-07-03 08:52:49
1stOpt求解:

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
...

你好,我今天下载了个1stopt,不怎么会用啊,这个和matlab一样吗?
憧憬未来
6楼2012-07-03 09:31:42
已阅   回复此楼   关注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的回帖
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +3 rFEsUBKXRll0 2026-09-02 6/300 2026-09-03 16:49 by T0rGB46095mJ
[找工作] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 ero8OE6tv9cu 2026-09-02 8/400 2026-09-03 16:38 by T0rGB46095mJ
[硕博家园] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 ero8OE6tv9cu 2026-09-02 5/250 2026-09-03 16:38 by T0rGB46095mJ
[考研] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 10/500 2026-09-03 16:27 by T0rGB46095mJ
[找工作] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +3 YLHlRHNwYkce 2026-09-02 9/450 2026-09-03 15:21 by T0rGB46095mJ
[教师之家] 售SCI一区T0P文章,我:8.O55.1.O.54,科目全,可十急 +3 ero8OE6tv9cu 2026-09-02 8/400 2026-09-03 14:48 by T0rGB46095mJ
[教师之家] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +3 YLHlRHNwYkce 2026-09-02 8/400 2026-09-03 12:03 by T0rGB46095mJ
[基金申请] 麻烦专家们看看评委们的意见(F口面上) +8 gdd2018 2026-08-28 13/650 2026-09-03 06:22 by 羽毛枫f
[公派出国] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 ero8OE6tv9cu 2026-09-02 4/200 2026-09-03 03:14 by rM1TE0WVDIIY
[基金申请] 科研人应该花精力去思考如何解决问题,而不是去凝练问题 +7 瞬息宇宙 2026-09-01 14/700 2026-09-02 17:33 by ma0526
[基金申请] 要骂人了,新模版改版就是要淡化问题凝练这种虚的东西,结果有个评委还在说凝练得不够 +9 瞬息宇宙 2026-08-31 17/850 2026-09-02 14:04 by anjeeshine
[基金申请] 基金系统什么内容也没有 30+4 winsaint 2026-08-27 10/500 2026-09-02 11:35 by 大不刘6
[基金申请] 学科评审组评审是指会评吗? +5 瞬息宇宙 2026-08-31 5/250 2026-09-02 10:13 by 雨冰共舞
[基金申请] 面上意见出来了 +12 黄鸟于飞Chao 2026-08-29 23/1150 2026-08-31 18:57 by 黄鸟于飞Chao
[基金申请] 能否申诉? +7 echo8914667 2026-08-30 8/400 2026-08-31 17:00 by yihongxu
[基金申请] 中青基了要发朋友圈吗? +7 349506619 2026-08-28 7/350 2026-08-31 13:39 by 冼亮淀粉酶
[基金申请] 29号明天会评吗 +4 笨笨唐 2026-08-28 4/200 2026-08-31 09:30 by huixian257
[基金申请] 为什么到现在没收到通知? +5 tannykie 2026-08-29 5/250 2026-08-30 21:05 by purplejack
[基金申请] 我就是申请一个面上项目而已,这评审意见是按照杰青的条件评的吧? +6 gouxfjh 2026-08-28 11/550 2026-08-30 07:57 by gouxfjh
[基金申请] 国自然评审意见 +13 wangmingqi 2026-08-28 19/950 2026-08-29 10:22 by Poppy1104
信息提示
请填处理意见