clf()
data=array([[0,0],[-1.5,0]])
phi=0
R=array([[cos(phi),-sin(phi)],[sin(phi),cos(phi)]])
data=dot(R, data)
axis([-2,2,-2,3])
#print data[0,:], data[1,:]
plot(data[0,:],data[1,:])
plot(0,0,'o')
theta=pi-pi/1000
thetadot=0
t=0
dt=.2
tfinal=50
while(t<tfinal):
     t=t+dt
     theta=theta+thetadot*dt
     thetadot=thetadot-sin(theta)*dt
     R=[[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]
     datanew=dot(R,data)
     plot(datanew[0,0],datanew[1,0])
     #print datanew[0,0],datanew[1,0]
     plot(datanew[0,:],datanew[1,:])
ylim(-1.5,1.5)
show()

Kreyszig-6.7_3 (last edited 2010-12-18 10:13:44 by telugupraveenkumar)