声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 3374|回复: 2

请教matlab解常微分方程组

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

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

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

x
<P>为什么结果中会出现1.0e-006 *的字样,程序见最后,运行结果如下<BR><BR>Results by using ode45():<BR>  Columns 1 through 4 <BR><BR>                  0   5.01000000000000   7.51500000000000                  0<BR>   0.01000000000000   4.13485131470842   6.43984788572855   1.39799207811633<BR>   0.02000000000000   3.44758152320393   5.52114353135189   2.56308685158067<BR>   0.03000000000000   2.88227350501698   4.74679740666201   3.50341358451941<BR>   0.04000000000000   2.41653435229744   4.09216256729740   4.26205575708555<BR>   0.05000000000000   2.03217524208578   3.53707621966476   4.87385280064125<BR>   0.06000000000000   1.71435628646564   3.06495078243123   5.36707396630125<BR>   0.07000000000000   1.45097171346299   2.66212545408824   5.76464463014267<BR>   0.08000000000000   1.23227208332134   2.31748114244378   6.08490640206789<BR>   0.09000000000000   1.05019512891767   2.02170960733801   6.34292946270182<BR>   0.10000000000000   0.89816160057097   1.76711088582958   6.55091023207195<BR><BR>  Columns 5 through 8 <BR><BR>                  0                  0                  0                  0<BR>   1.85417181101065   0.24242050252632   0.00000000127553   0.02755016531156<BR>   3.47326108268142   0.46693935334930   0.00000000134597   0.02361905620216<BR>   4.82434258441260   0.67032127023475   0.00000000141331   0.02027676642426<BR>   5.95468857583128   0.85454973825349   0.00000000147659   0.01742564578963<BR>   6.90285331290088   1.02140383872519   0.00000000153439   0.01498924068954<BR>   7.70042088738478   1.17248184606668   0.00000000158497   0.01290519252663<BR>   8.37328400050171   1.30922201148748   0.00000000162644   0.01112137975657<BR>   8.94241237043581   1.43290354260834   0.00000000165653   0.00959604442601<BR>   9.42527170416793   1.54469575551820   0.00000000167425   0.00828965815828<BR>   9.83622305409098   1.64565833968169   0.00000000167814   0.00717051296770<BR><BR>  Columns 9 through 12 <BR><BR>                  0                  0                  0                  0<BR>   0.01487537005217   0.00000635950258   0.00000159951088   0.00004449791139<BR>   0.01188996848660   0.00000619685408   0.00000148163931   0.00004654861490<BR>   0.00957538000765   0.00000603525221   0.00000132989826   0.00004844465404<BR>   0.00775862261725   0.00000587728523   0.00000119685800   0.00005022986351<BR>   0.00632119422608   0.00000572427936   0.00000108178341   0.00005193644928<BR>   0.00517615801544   0.00000557772102   0.00000098246945   0.00005358686151<BR>   0.00425878093285   0.00000543879846   0.00000089690102   0.00005519692867<BR>   0.00352040597361   0.00000530984469   0.00000082333614   0.00005676360925<BR>   0.00292380589974   0.00000518995721   0.00000076018048   0.00005830197757<BR>   0.00243978006073   0.00000507966164   0.00000070602171   0.00005981314719<BR><BR>  Columns 13 through 16 <BR><BR>                  0                  0                  0                  0<BR>   0.00001432058256   0.00000208776181   0.00007554196860   0.05361993867842<BR>   0.00001346707926   0.00000187341242   0.00006446725765   0.04743270307420<BR>   0.00001263867168   0.00000168826725   0.00005485176875   0.04167209530931<BR>   0.00001183812644   0.00000152627217   0.00004657371352   0.03637666942422<BR>   0.00001106451339   0.00000138282258   0.00003948062110   0.03153849678097<BR>   0.00001031728713   0.00000125453517   0.00003342976593   0.02715070521960<BR>   0.00000959597228   0.00000113888270   0.00002828763617   0.02320405525700<BR>   0.00000890289827   0.00000103414809   0.00002393339278   0.01968787828191<BR>   0.00000823565632   0.00000093871262   0.00002025565213   0.01658389853409<BR>   0.00000759495746   0.00000085143871   0.00001715646937   0.01387123157608<BR><BR>  Columns 17 through 18 <BR><BR>                  0                  0<BR>   0.00000000000000   0.00000000000016<BR>   0.00000000000000   0.00000000000015<BR>   0.00000000000000   0.00000000000013<BR>   0.00000000000000   0.00000000000012<BR>   0.00000000000000   0.00000000000011<BR>   0.00000000000000   0.00000000000009<BR>   0.00000000000000   0.00000000000008<BR>   0.00000000000000   0.00000000000007<BR>   0.00000000000000   0.00000000000006<BR>   0.00000000000000   0.00000000000005<BR><BR>Cbanlance,Hbanlance,Obanlance:<BR>  1.0e-006 *<BR><BR>  -0.00000000088818                  0                  0<BR>   0.01352816670742  -0.02065940068556   0.02346317154819<BR>  -0.01075123884248  -0.10054292322770  -0.01225026438725<BR>   0.04524795755838   0.00057467034584   0.05518473977143<BR>  -0.08111397253933  -0.12845423767213  -0.05916933099101<BR>   0.00696812014700   0.12466885183850  -0.01876261282997<BR>  -0.00199972709785   0.07646786177685  -0.00829187888496<BR>  -0.00733501590228  -0.01100774752679  -0.00116685988822<BR>   0.00854392779299   0.03457823715796   0.05003402113966<BR>  -0.00880554723832  -0.02175283199375  -0.00626595662938<BR>  -0.00724876952105  -0.00868484242837  -0.00322983494963<BR><BR>&gt;&gt; <BR>程序如下:<BR>function Simulate</P>
<P>clear all;clc</P>
<P><BR>Y0=[5.010 7.515 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];<BR>[t,Y]=ode23s(@f,[0:0.01:0.1],Y0);<BR>options.AbsTol=1e-30;           % 绝对误差为1e-30;<BR>disp('Results by using ode45():')<BR>disp([t Y])<BR>plot(t,Y),xlabel('t'),ylabel('Y')<BR>legend('CH4','CO2','H2','CO','H2O','O2','CH3','CH2','CH','C','H','O','OH','HCO','CH2O','CH3O','HO2')<BR>Cbanlance=Y0(1)+Y0(2)-Y(:,1)-Y(:,2)-Y(:,4)-Y(:,7)-Y(:,8)-Y(:,9)-Y(:,10)-Y(:,14)-Y(:,15)-Y(:,16);<BR>Hbanlance=4*Y0(1)-4*Y(:,1)-2*Y(:,3)-2*Y(:,5)-3*Y(:,7)-2*Y(:,8)-Y(:,9)-Y(:,11)-Y(:,13)-Y(:,14)-2*Y(:,15)-3*Y(:,16)-Y(:,17);<BR>Obanlance=2*Y0(2)-2*Y(:,2)-Y(:,4)-Y(:,5)-2*Y(:,6)-Y(:,12)-Y(:,13)-Y(:,14)-Y(:,15)-Y(:,16)-2*Y(:,17);<BR>disp('Cbanlance,Hbanlance,Obanlance:')<BR>disp([Cbanlance Hbanlance Obanlance])<BR>%--------------------------------------------------------------------------<BR>function dYdt=f(t,Y)</P>
<P>M=12.525;NA=6.02217e+23;<BR>electrondensity=2e+11;Ne=electrondensity*1e+06/NA;</P>
<P>K01=3.234e+07;K02=1.960e+07;K03=1.251e+07;K04=3.788e+02;K05=2.673e+07;<BR>K1=3.137e+05;K2=2.984e+05;K3=2.165e+06;K4=5.443e+07;K5=8.000e+06;K6=8.000e+07;K7=3.337e+03;<BR>K8=2.000e+07;K9=8.131e+05;K10=4.000e+07;K11=1.475e+07;K12=1.119e+05;K13=9.479e+05;K14=2.500e+07;<BR>K15=2.000e+07;K16=1.000e+07;K17=4.000e+07;K18=1.688e+07;K19=4.490e+04;K20=5.697e+06;<BR>K21=3.175e+06;K22=6.896e+06;K23=1.401e+04;K24=6.009e+04;K25=5.000e+07;K26=2.000e+08;<BR>K27=3.000e+07;K28=3.000e+07;K29=3.000e+06;K30=1.118e+06;K31=9.358e+06;K32=2.324e+04;<BR>K33=1.000e+04;K34=6.846e+02;K35=1.881e+03;K36=9.359e+03;K37=3.824e+06;K38=1.000e+07;<BR>K39=2.219e+05;K40=1.746e+05;K41=1.958e+05;K43=1.407e+06;K44=2.894e+10;K45=1.741e+07;<BR>K46=2.000e+07;K47=1.500e+07;K48=1.965e+07;K49=1.965e+07;K50=1.581e+06;K51=1.066e+06;</P>
<P>f1=K4*Y(7)*Y(11)+K9*Y(7)*Y(17)+K23*Y(15)*Y(7)+K31*Y(14)*Y(7)-(K01+K02+K03+K04)*Y(1)*Ne-K1*Y(1)*Y(11)-K2*Y(1)*Y(12)-K3*Y(1)*Y(13);<BR>f2=K13*Y(8)*Y(6)+K28*Y(14)*Y(12)+K41*Y(4)*Y(13)-K05*Y(2)*Ne-K51*Y(2)*Y(9);<BR>f3=K02*Y(1)*Ne+K03*Y(1)*Ne+K1*Y(1)*Y(11)+K5*Y(7)*Y(13)+K10*Y(8)*Y(11)+K21*Y(15)*Y(11)+K26*Y(14)*Y(11)+K35*Y(11)*Y(11)*M+K39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(13)*Y(11)*M-2*K37*Y(13)*Y(13)-K38*Y(12)*Y(13)-K39*Y(11)*Y(13)-K41*Y(4)*Y(13)-K43*Y(13)*Y(3)-K47*Y(17)*Y(13)-K49*Y(10)*Y(13);<BR>f14=K11*Y(8)*Y(6)+K16*Y(9)*Y(6)+K20*Y(15)*Y(12)+K21*Y(15)*Y(11)+K22*Y(15)*Y(13)+K23*Y(15)*Y(7)+K51*Y(2)*Y(9)-K24*Y(14)*M-K25*Y(14)*Y(13)-K26*Y(14)*Y(11)-K27*Y(14)*Y(12)-K28*Y(14)*Y(12)-K29*Y(14)*Y(6)-K30*Y(14)*Y(17)-K31*Y(14)*Y(7);<BR>f15=K5*Y(7)*Y(13)+K6*Y(7)*Y(12)+K7*Y(7)*Y(6)+K14*Y(8)*Y(13)+K18*Y(16)*M+K19*Y(16)*Y(6)+K30*Y(14)*Y(17)-K20*Y(15)*Y(12)-K21*Y(15)*Y(11)-K22*Y(15)*Y(13)-K23*Y(15)*Y(7);<BR>f16=K8*Y(7)*Y(17)-K18*Y(16)*M-K19*Y(16)*Y(6);<BR>f17=K19*Y(16)*Y(6)+K29*Y(14)*Y(6)+K36*Y(11)*Y(6)*M-K8*Y(7)*Y(17)-K9*Y(7)*Y(17)-K30*Y(14)*Y(17)-K44*Y(17)*Y(11)-K45*Y(17)*Y(11)-K46*Y(17)*Y(12)-K47*Y(17)*Y(13);<BR>dYdt=[f1;f2;f3;f4;f5;f6;f7;f8;f9;f10;f11;f12;f13;f14;f15;f16;f17];<BR></P>
回复
分享到:

使用道具 举报

发表于 2005-12-20 21:14 | 显示全部楼层

回复:(mathtype)请教matlab解常微分方程组

表示其解的结果是显示的数值乘以1.0e-006 <BR><BR>你输入a=[0.0000001 0.0000002]看看结果是什么样的就知道这表示什么意思了
 楼主| 发表于 2005-12-21 11:30 | 显示全部楼层

回复:(tammy)回复:(mathtype)请教matlab解常微分...

谢谢
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-11-21 01:38 , Processed in 0.072872 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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