|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
[求助]程序修改!关于微分方程组的! 高手来帮下(急)
下面是程序:
function rgka4
y0=[-45,0.12,0.45];
tspan=[0:1:100];
N = length(tspan);
h = ones(1,N);
y0 = y0(:);
neq = length(y0);
Y = zeros(neq,N);
F = zeros(neq,4);
Y(:,1)=y0;
for i=2:N
ti=tspan(i-1);
hi=h(i-1);
yi=Y(:,i-1);
F(:,1)=feval(@odefun,ti,yi);
F(:,2)=feval(@odefun,ti+0.5*hi,yi+0.5*hi*F(:,1));
F(:,3)=feval(@odefun,ti+0.5*hi,yi+0.5*hi*F(:,2));
F(:,4)=feval(@odefun,ti,yi+hi*F(:,3)); %18行
Y(:,i)=yi + (hi/6)*(F(:,1) + 2*F(:,2) + 2*F(:,3) + F(:,4));
end
Y = Y.';
function f=odefun(t,s)
V=s(1);
n=s(2);
p=s(3);
am=0.1*(25 + V)/(1 - exp(-0.1*V - 2.5));
bm=4*exp(-(V + 50)/18);
ah=0.07*exp(-0.05*V - 2.5);
bh=1/(1 + exp(-0.1*V - 2));
an=0.01*(20 + V)/(1 - exp(-0.1*V - 2));
bn=0.125*exp(-(V + 30)/80);
gI=1800; gK=1700; gP=11.5;
gL=7; VI=100; VK= -75;
VL=-40; KC=0.18; tx_n=0.00435;
tp=5.0;
minf=am/(am + bm);hinf=ah/(ah + bh);
ninf=an/(an + bn);t_n=tx_n/(an + bn);
dVdt=gI*(minf^3)*(hinf)*(VI- V) + gK*(n^4)*(VK- V) + gP*p*(VK- V) + gL*(VL- V);
dndt=(ninf - n)/t_n; %43行
dpdt=(((minf^3)*(hinf)*(VI - V) - KC*p/(1-p))/tp)*((1-p).^2);
f = [dVdt dndt dpdt ]';
错误信息在下边
请高手来诊断阿!到底是怎么回事啊?很急!
>> Warning: Divide by zero.
(Type "warning off MATLAB:divideByZero" to suppress this warning.)
> In C:\MATLAB6p5\work\rgka4.m (odefun) at line 43
In C:\MATLAB6p5\work\rgka4.m at line 18
[ 本帖最后由 lxq 于 2007-4-26 18:09 编辑 ] |
|