import matplotlib.pyplot as plt
import numpy as np
import scipy as sc
import math
t,theta1=np.loadtxt('Single Small Angle 1.txt',unpack=True,skiprows=2)
t2,theta2=np.loadtxt('Single Small Angle 3.txt',unpack=True,skiprows=2)
theta=[]
omega=np.arange(int(len(theta1)/5)-1)
for x in range (int(len(theta1)/5-1)):
omega[x]=(theta1[x*5]-theta1[(x+1)*5])/.005
theta[x]=theta1[x*5]
plt.plot(theta1,omega)
plt.xlabel("${\Theta}$ [rad]")
plt.ylabel("${\Omega}$ [rad/s]")
plt.title("Small Angle Approximation Phase Space")
plt.show()
Traceback (most recent call last):
theta[x]=theta1[x*5]
IndexError: list assignment index out of range
[Finished in 0.6s with exit code 1]
我不知道我在做什么,我只想修复错误。我只是想创建一个相位空间,我需要我的 theta1 东西的导数,所以我可以有 d(theta1)/dt。