声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2833|回复: 9

[编程技巧] [求助]请帮我看一下matlab解微分方程组

[复制链接]
发表于 2005-11-21 15:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
程序运行出错了
解常微分方程出错
??? Error using ==> KineticSimulate>f
Too many input arguments.

Error in ==> funfun\private\odearguments at 110
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

Error in ==> ode23s at 188
[neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ...

Error in ==> KineticSimulate at 15
[t,y]=ode23s(@f,[0:0.001:1],y0,k01,k02,k03,k04,k05,k06,k07,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,k17,k18,k19,k20,k21,k22,k23,k24,k25);

谢谢!
回复
分享到:

使用道具 举报

发表于 2005-11-21 15:52 | 显示全部楼层

回复:(mathtype)[求助]请帮我看一下matlab解微分方...

附件呢?
 楼主| 发表于 2005-11-21 15:55 | 显示全部楼层

回复:(paul)回复:(mathtype)[求助]请帮我看一下...

对不起,我重新上传了
发表于 2005-11-21 20:53 | 显示全部楼层

回复:(mathtype)[求助]请帮我看一下matlab解微分方...

function KineticSimulate

clear all
clc

format long

y0=[5.010 7.515 0 0 0 0 0 0 0 0 0 0 0];

[t,y]=ode23s(@f,[0:0.001:1],y0);
%--------------------------------------------------------------------------
function dydt=f(t,y)

k01=4.598E+04;k02=1.334E+04;k03=4.862E+03;k04=3.788E+02;k05=1.049E+04;k06=1.753E+04;k07=4.198E+05;
Ne=[1.000E-07];
k1=5.446E+07; k2=3.126E+05; k3=1.838E+04; k4=2.162E+06; k5=2.974E+01; k6=1.989E+04; k7=4.927E+01; k8=9.391E+00; k9=4.000E+07;
k10=4.550E+01; k11=5.000E+07; k12=1.119E+05; k13=3.137E+04; k14=9.477E+05;k15=2.000E+07; k16=4.000E+07; k17=1.600E+08; k18=1.000E+07;
k19=1.742E+05; k20=2.215E+05; k21=1.406E+06; k22=3.824E+06; k23=4.185E+04; k24=3.041E+03; k25=1.959E+05;

f1=k1*y(7)*y(11)+k3*y(7)*y(3)+k6*y(7)*y(13)-k01*y(1)*Ne-k02*y(1)*Ne-k03*y(1)*Ne-k04*y(1)*Ne-k2*y(1)*y(11)-k4*y(1)*y(13)-k5*y(1)*y(12);
f2=k14*y(8)*y(6)+k25*y(4)*y(13)-k05*y(2)*Ne-k17*y(11)*y(2);
f3=k02*y(1)*Ne+k03*y(1)*Ne+k2*y(1)*y(11)+k9*y(8)*y(11)+k20*y(11)*y(13)-k07*y(3)*Ne-k07*y(3)*Ne-k3*y(7)*y(3)-k19*y(3)*y(12)-k21*y(13)*y(3);
f4=k05*y(2)*Ne+k12*y(8)*y(6)+k13*y(8)*y(6)+k15*y(9)*y(6)+k16*y(11)*y(2)-k06*y(4)*Ne-k25*y(4)*y(13);
f5=k4*y(1)*y(13)+k10*y(8)*y(13)+k13*y(8)*y(6)+k21*y(13)*y(3)+k22*y(13)*y(13)-k24*y(5)*y(12);
f6=k18*y(12)*y(13)-k12*y(8)*y(6)-k13*y(8)*y(6)-k14*y(8)*y(6)-k15*y(9)*y(6)-k23*y(11)*y(6);
f7=k01*y(1)*Ne+k2*y(1)*y(11)+k4*y(1)*y(13)+k5*y(1)*y(12)-k1*y(7)*y(11)-k3*y(7)*y(3)-k6*y(7)*y(13);
f8=k02*y(1)*Ne+k8*y(9)*y(13)-k7*y(8)*y(12)-k9*y(8)*y(11)-k10*y(8)*y(13)-k11*y(8)*y(11)-k12*y(8)*y(6)-k13*y(8)*y(6)-k14*y(8)*y(6);
f9=k03*y(1)*Ne+k7*y(8)*y(12)+k9*y(8)*y(11)+k10*y(8)*y(13)+k11*y(8)*y(11)-k8*y(9)*y(13)-k15*y(9)*y(6)-k16*y(9)*y(12);
f10=k04*y(1)*Ne+k06*y(4)*Ne;
f11=k01*y(1)*Ne+k03*y(1)*Ne+4*k04*y(1)*Ne+2*k07*y(3)*Ne+k3*y(7)*y(3)+2*k11*y(8)*y(11)+2*k14*y(8)*y(6)+k21*y(13)*y(3)+k25*y(4)*y(13)+k19*y(3)*y(12)+k21*y(13)*y(3)+k25*y(4)*y(13)-k1*y(7)*y(11)-k17*y(11)*y(2)-k20*y(11)*y(2)-k23*y(11)*y(6);
f12=k05*y(2)*Ne+k06*y(4)*Ne+k6*y(7)*y(13)+k8*y(9)*y(13)+k20*y(11)*y(13)+k22*y(13)*y(13)+k23*y(11)*y(6)-k5*y(1)*y(12)-k7*y(8)*y(12)-k16*y(9)*y(12)-k18*y(12)*y(13)-k19*y(3)*y(12)-k24*y(5)*y(12);
f13=k7*y(8)*y(12)+k12*y(8)*y(6)+15*y(9)*y(6)+k17*y(11)*y(2)+k19*y(3)*y(12)+k23*y(11)*y(6)+2*k24*y(5)*y(12)-k4*y(1)*y(13)-k6*y(7)*y(13)-k8*y(9)*y(13)-k10*y(8)*y(13)-k18*y(12)*y(13)-k20*y(11)*y(13)-k21*y(13)*y(3)-k22*y(13)*y(13)-k25*y(4)*y(13);
dydt=[f1;f2;f3;f4;f5;f6;f7;f8;f9;f10;f11;f12;f13];
发表于 2005-11-21 20:53 | 显示全部楼层

回复:(mathtype)[求助]请帮我看一下matlab解微分方...

y0多了一个数字

现在可以运行但是不知道结果对不对
发表于 2005-11-26 13:22 | 显示全部楼层
这么复杂的程序是怎么编出来的?
 楼主| 发表于 2005-11-30 11:20 | 显示全部楼层

回复:(angle)回复:(mathtype)[求助]请帮我看一下...

谢谢。按照你的建议,我修改成功了,请密切关注我的下一个问题
 楼主| 发表于 2005-11-30 11:29 | 显示全部楼层

回复:(angle)回复:(mathtype)[求助]请帮我看一下...

请帮我看一下解数值积分问题,万分感谢!
发表于 2011-9-13 19:04 | 显示全部楼层
楼主能否帮忙看看我的程序?
发表于 2011-9-14 10:15 | 显示全部楼层
回复 9 # WF1987 的帖子

楼主已经五年多没出现了!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-11-29 05:55 , Processed in 0.060675 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表