admin管理员组

文章数量:1576340

我试图解决r中的ODE问题 . 我有一个参数Q,当它变得比另一个参数大时,h停止流入它 . ODE工作正常,直到它到达切换发生的点,然后停止运行并给我消息:

DLSODA- At current T (=R1), MXSTEP (=I1) steps

taken on this call before reaching TOUT

In above message, I1 = 5000

In above message, R1 = 6.65299

Warning messages:

1: In lsoda(y, times, func, parms, ...) :

an excessive amount of work (> maxsteps ) was done, but integration was

not successful - increase maxsteps

2: In lsoda(y, times, func, parms, ...) :

Returning early. Results are accurate, as far as they go

代码如下

parameters

a = 0.032,

b = (9 / 140),

c = (5 / 1400),

d = (95 / 700),

k = 1 / 140,

i = 0.25,

# r = 0.2,

n = 6000000,

x = 0.5 ,

y = 0.4,

t = 1 / 180, # important in looking at the shape

u = 1 / 180, # important in looking at the shape

v = 1 / 360, # important in looking at the shape

p = 10,

s = 10000,

g = 100

# e = .4,

#h = 1000

)

state

S = 5989900,

E = 0,

I = 0,

Q = 0,

D = 100,

B = 0,

C = 100,

Y = 100,

H = 1000,

R = 1000,

J = 1000,

h = 1000,

e = 0.1,

r = 0.1

)

equation

with(as.list(c(state, parameters)), {

# rate of change

dS

dE

if (h > Q)

j = 1

else if (h <= Q)

j = 0

dI

dQ

dD

dB

dC

dY

dR

de

dJ

dr

dH

dh

# return the rate of change

list(c(dS, dE, dI, dQ, dD, dB, dC, dY, dR, de, dJ, dr, dH, dh))

}))

#

# solve the equations for certain starting parameters

library(deSolve)

times

out

ode(y = state,

times = times,

func = equation,

parms = parameters

)

本文标签: Java