| 查看: 252 | 回复: 0 | ||
郑美琴琴金虫 (著名写手)
|
[求助]
matlab程序出错
|
大神帮帮忙,感激不尽!!!![]() ![]() ![]() M文件 function yt=ped_a(t,y) global nr nz dr dz drs dzs... r z Ds DL c q... cs v e R kf K... c0 p n ncall %1D to 2D矩阵 for i=1:nz for j=1:nr ij=(i-1)*nr+j; c(i)=y(i); q(i,j)=y(ij+nz); end end %r,z网格化 for i=1:nz for j=1:nr %2/r*qr if(j==1) %r=0 qr(i,j)=2.0*(q(i,j+1)-q(i,j))/drs; elseif(j==nr) %r=R qr(i,j)=2/R*kf/(p*Ds)*(c(i)-cs); else qr(i,j)=2/r(j)*(q(i,j+1)-q(i,j-1))/(2*dr); end %qrr if(j==1) qrr(i,j)=2.0*(q(i,j+1)-q(i,j))/drs; elseif(j==nr) qf(i,j)=q(i,j-1)+2.0*dr*kf/(p*Ds)*(c(i)-cs); qrr(i,j)=(qf(i,j)-2.0*q(i,j)+q(i,j-1))/drs; else qrr(i,j)=(q(i,j+1)-2.0*q(i,j)+q(i,j-1))/drs; end %cz if(i==1) %z=0 cz(i)=(c(i)-c0)/dz; elseif(i==nz) %z=L cz(i)=0; else cz(i)=(c(i)-c(i-1))/dz; end %czz czz(i)=(c(i+1)-2.0*c(i)+c(i-1))/dzs; %PDEs qt(i,j)=Ds*(qrr(i,j)+qr(i,j)); ct(i)=DL*czz(i)-v*cz(i)-3*(1-e)/(e*R)*kf*(c(i)-cs(i,j)); q(i,j)=K*cs(i,j)^(1/n); end end %2D to 1D for i=1:nz for j=1:nr ij=(i-1)*nr+j; yt(i)=ct(i); yt(ij+nz)=qt(i,j); end end %转置和计数 yt=yt'; ncall=ncall+1; Command window: %全部区域 >> global nr nz dr dz drs dzs... r z Ds DL c q... cs v e R kf K... p n ncall >> %模型参数 >> c0=250; >> L=0.15; >> R=0.001; >> p=436.8; >> v=5.8*10^(-5); >> e=0.363; >> DL=1.66*10^(-7); >> Ds=2.4281*10^(-12); >> K=0.14; >> n=1; >> %z方向网格 >> nz=20; >> dz=L/nz; >> for i=1:nz z(i)=i*dz; end >> dzs=dz^2; >> %r方向网格 >> nr=7; >> dr=R/(nr-1); >> for j=1:nr r(j)=(j-1)*dr; end >> drs=dr^2; %ODE集成 >> tf=200; >> tout=[0.0:50:tf]; >> nout=5; >> ncall=0; >> %初始条件 >> for i=1:nz for j=1:nr if(i==1) c(i)=c0 else c(i)=0 end q(i,j)=0 y0(i)=c(i); y0((i-1)*nr+j+nz)=q(i,j) end end %ODE集成 >> reltol=1.0e-04; abstol=1.0e-04; options=odeset('RelTol',reltol,'AbsTol',abstol); [t,y]=ode15s(@ped_a,tout,y0,options); 模拟结果: ??? In an assignment A(I) = B, the number of elements in B and I must be the same. Error in ==> ped_a at 36 cz(i)=(c(i)-c0)/dz; Error in ==> funfun\private\odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. Error in ==> ode15s at 227 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ... |
» 猜你喜欢
实验室接单子
已经有6人回复
假如你的研究生提出不合理要求
已经有11人回复
全日制(定向)博士
已经有5人回复
萌生出自己或许不适合搞科研的想法,现在跑or等等看?
已经有4人回复
Materials Today Chemistry审稿周期
已经有4人回复
参与限项
已经有3人回复
对氯苯硼酸纯化
已经有3人回复
求助:我三月中下旬出站,青基依托单位怎么办?
已经有12人回复
所感
已经有4人回复
要不要辞职读博?
已经有7人回复

找到一些相关的精华帖子,希望有用哦~
请问这段小matlab代码怎么修改?
已经有10人回复
matlab程序错误,提示如下【弄了半夜还是不行】
已经有10人回复
matlab 运行ode45出错,不知道什么原因
已经有4人回复
matlab求函数积分出错
已经有12人回复
matlab一运行就出现的问题
已经有7人回复
有个matlab程序,但是运行不下来,求高手
已经有23人回复
matlab程序中调用m文件的问题
已经有13人回复
请教MATLAB中的LMI求解问题,急!!!
已经有7人回复
matlab-出错提示Undefined method for input arguments type 'double'.
已经有5人回复
求助多输出支持向量机的matlab程序
已经有6人回复
大家爱帮我看看这段MATLAB程序为啥出错了
已经有5人回复
模式搜索MATLAB程序
已经有9人回复
matlab程序问题,总是出错,麻烦大家看看问题在那里?
已经有6人回复
求MATLAB程序包SDELab
已经有8人回复
matlab赋值问题
已经有5人回复
同样的MATLAB程序,为何在别人的电脑上运行不了
已经有21人回复
看不懂matlab程序该怎么办?
已经有7人回复
求助matlab编程
已经有13人回复
科研从小木虫开始,人人为我,我为人人













回复此楼
点击这里搜索更多相关资源