CodePudding user response:
Physics has also physics teacher, and I was not sure, you see whether you want to the function of
The import numpy as np
The import math
The import matplotlib. Pyplot as PLT
Xx=[]
Yy=[]
M=1
Where v0=50
G=9.8
K=0.3
Theta=45 * math.h PI/180
V0x=where v0 * math. Cos (theta)
V0y math.=where v0 * sin (theta)
Dt=0.01
Sx=0
Sy=0
While True:
VX=(1/m) * (k * v0x) * dt
VY=(1/m) * (m + k * * g v0y) * dt
V0x +=vX
V0y +=vY
Sx +=v0x * dt
Sy +=v0y * dt
If sy<0: break
Xx. Append (sx)
Yy. Append (sy)
PLT. The plot (xx, yy, '-')
PLT. The show ()
CodePudding user response:
According to the perspective mapping x axes is probably so to change
The import math
The import matplotlib. Pyplot as PLT
Def get_sx (jiaodu) :
M=1
Where v0=50
G=9.8
K=0.3
Theta=jiaodu * math.h PI/180
V0x=where v0 * math. Cos (theta)
V0y math.=where v0 * sin (theta)
Dt=0.01
Sx=0
Sy=0
While True:
VX=(1/m) * (k * v0x) * dt
VY=(1/m) * (m + k * * g v0y) * dt
V0x +=vX
V0y +=vY
Sx +=v0x * dt
Sy +=v0y * dt
If sy<0:
Return sx
Xx=[]
Yy=[]
For I in range (10,80,5) :
Xx. Append (I)
Yy. Append (get_sx (I))
PLT. The plot (xx, yy, '-')
PLT. The show ()
You write the code I don't understand your logic, so don't know how to change, you can refer to my own change again
CodePudding user response:
Really thank you! Physical relationship is all right! But my problem is with the x axis displacement Angle theta image, if you can point me to use for statement to draw out the image of syntax errors would be even better! Thank you again forCodePudding user response:
I figure is not Angle theta and corresponding relation of x axis direction? Theta in the x direction distance between 30 ~ 40 Angle reaches the maximum,You r in the for loop is to represent the Angle? Not involved in calculating your point of view,
CodePudding user response: