ode15s解时出错:Index exceeds matrix dimensions
<P>function dydt=dyncstr(t,y)<BR>global T0 UA<BR>Vr=10;<BR>v0=1000;<BR>CA0=0.3;<BR>CB0=0;<BR>Ta=273.15+60;<BR>CpA=200;<BR>CpB=CpA;<BR>CpC=CpA;<BR>E1=9900;<BR>E2=27000;<BR>R=1.987;<BR>DHr1=-55000;<BR>DHr2=-71500;<BR>T=y(1);<BR>CA=y(2);<BR>CB=y(3);<BR>k1=3.3*exp((E1/R)*(1/300.-1/T));<BR>k2=4.58*exp((E2/R)*(1/500.-1/T));<BR>dTdt=(UA*(Ta-T)+v0*CA0*CpA*(T0-T)-(Vr*(k1*CA)*DHr1+Vr*(k2*CB)*DHr2))/Vr/CA0/CpA;<BR>dCAdt=(v0*CA0-v0*CA-(k1*CA)*Vr)/Vr;<BR>dCBdt=(v0*CB0-v0*CB-(k2*CB-k1*CA)*Vr)/Vr;<BR>dydt(1)=dTdt;<BR>dydt(2)=dCAdt;<BR>dydt(3)=dCBdt;<BR>dydt=dydt';<BR>***********************************************************************<BR> clear;<BR>>> global T0 UA<BR>>> UA=60000;Tr=678.4069;Ca=8.5938e-004;Cb=0.0051;<BR>>> for i=1:200,<BR>T0=400-i;<BR>y0=;tspan=;<BR>=ode15s('dyncstr',tspan,y0);<BR>Tr=y(50,1);Ca=y(50,2);Cb=y0(50,3);<BR>for j=1:50,<BR>kk=(i-1)*50+j;tt(kk)=((i-1)*50+j)*0.01;<BR>yt(kk)=T0;yy(kk)=y(j,1);<BR>end<BR>plot(tt,yy,'-',tt,yt,'-')<BR>axis();pause(0.01)<BR>end</P> <FONT color=#f70938>??? Index exceeds matrix dimensions.怎么回事?</FONT>回复:(amygod)ode15s解时出错:Index exceeds matr...
<DIV class=quote><B>以下是引用<I>amygod</I>在2006-6-6 19:16:23的发言:</B><BR><P>y0=;tspan=;<BR>=ode15s('dyncstr',tspan,y0);<BR>Tr=y(50,1);Ca=y(50,2);Cb=y0(50,3);<BR>for j=1:50,</P></DIV>
<P>你上面定义的tspan是50个点,<BR>改为<BR>............................<BR>Tr=y(49,1);Ca=y(49,2);Cb=y0(49,3);<BR>for j=1:49,<BR>.................................<BR>应该就好了<BR>我的matlab有问题,没有试,你试一下先</P>
页:
[1]