- #1
javiergra24
- 19
- 0
Hi guys
I've done a Runge-Kutta script for the Lorenz Equations in python, I need to write data for (t,x,y,z) in a .dat file in order to reprint in a table. How can a do it?
Imported routines are:
import sys, pylab, numpy
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from numpy import *
import matplotlib.pyplot as plt
Mi iteration code is:
for n in xrange(0,N):
# at each time step calculate new x(t),y(t),z(t)
# and append to lists x0, y0, z0
x,y,z = RKTwoD(x0[n],y0[n],z0[n],VDPXDot,VDPYDot,VDPZDot,dt)
x0.append(x)
y0.append(y)
z0.append(z)
t.append(t[n] + dt)
savetxt('output.dat', (t,x0,y0,z0))
But it doesn't work, file just contain six columns instead of four and it takes too long to execute the script.
Please can anyone help me?
Thank you
I've done a Runge-Kutta script for the Lorenz Equations in python, I need to write data for (t,x,y,z) in a .dat file in order to reprint in a table. How can a do it?
Imported routines are:
import sys, pylab, numpy
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from numpy import *
import matplotlib.pyplot as plt
Mi iteration code is:
for n in xrange(0,N):
# at each time step calculate new x(t),y(t),z(t)
# and append to lists x0, y0, z0
x,y,z = RKTwoD(x0[n],y0[n],z0[n],VDPXDot,VDPYDot,VDPZDot,dt)
x0.append(x)
y0.append(y)
z0.append(z)
t.append(t[n] + dt)
savetxt('output.dat', (t,x0,y0,z0))
But it doesn't work, file just contain six columns instead of four and it takes too long to execute the script.
Please can anyone help me?
Thank you