我想循环一系列 c 值?我怎么做?我尝试在外部使用 for 循环或 while 循环:
注意:我希望 c 介于 4 到 15 之间,有 120 个值
for c in range(4,15):
i=0
while i< nt-1: #if i<nt-1 is true, the body below will be excuted
#Update the acceleration using the following equation
x[i+1] = (-y[i]-z[i])*deltat+x[i]
#Update the velocity using the follwing equation
y[i+1] =(x[i]+a*y[i])*deltat+y[i]
#Update the displacement, using follwing equation
z[i+1] = (b+z[i]*(x[i]-c))*deltat+z[i]
#go to next time step
i=i+1
或者
c=arange(4,15,1)
for p in c:
while i< nt-1: #if i<nt-1 is true, the body below will be excuted
#Update the acceleration using the following equation
x[i+1] = (-y[i]-z[i])*deltat+x[i]
#Update the velocity using the follwing equation
y[i+1] =(x[i]+a*y[i])*deltat+y[i]
#Update the displacement, using follwing equation
z[i+1] = (b+z[i]*(x[i]-p))*deltat+z[i]
#go to next time step
i=i+1