#!/usr/bin/env python from math import * import numpy as np import pylab as pl import scipy as sp import sys as sys #try: # K = float(sys.argv[1]) #except: # print "Bitte Kopplungsstaerke angeben." # sys.exit(1) K=0.125 # die system parameter la = 0.25 w = pi tau = pi/w # die numerik parameter tfinal = 100 dt = 0.01 N = int(tfinal/dt)+1; delta = int(tau/dt) # initialisiere die Arrays outx = np.zeros(N) outy = np.zeros(N) histx = np.zeros(delta) histy = np.zeros(delta) # die Anfangsbedingung histx[0] = 1.0 x=1 y=1 for i in range(N): xtau = histx[(i)%delta] ytau = histy[(i)%delta] x = x + dt * ( la*x + w*y - K*x + K*xtau ) y = y + dt * ( -w*x + la*y - K*y + K*ytau ) outx[i] = x outy[i] = y histx[(i)%delta] = x histy[(i)%delta] = y pl.plot(1,1,'ro') pl.plot(outx, outy) pl.show()