in the end of the flight the drag force in y direction has an opposite sign than gravity)ĭo for example: vel = np.sqrt(vx**2 + vy**2) This is because in every step you have new angle (i.e. When calculating the new velocities you also have to compute an updated angle. Also work with numpy arrays as vectors instead of having vx and vy separately.Īdditionally there is an error in your calculations. Implement for example a function which calculates a new time step. This makes your code easier to read and more reusable. Generally try to work with functions you can then call in for loops.Yes you definitely have to include all parameters of the projectile as the total distance traveled is very sensitive to that.Print("Range of projectile is m".format(x)) # With the new velocity calculate the drag force T.append(t+dt) # increment by dt and add to the list of time ![]() # Create the lists for acceleration components # parameters for the projectile motion without drag force Vx = # list for velocity x and y components # Start by putting the initial velocities at t=0 G = 9.8 # Acceleration due to gravity (m/s^2)Īng = 60.0 # Angle of initial velocity in degree It would be awesome if you're also willing to point out any errors I've made import numpy as np Is the way I'm doing it very complicated and how would you modify it to make it more efficient and neat? What caused this? Is it because the drag force I've put only includes drag coefficient and velocity, which made the graph smaller than the one that also has cross sectional area and rho included? (the smaller one is the one with drag while the bigger one is the one without it) There's a big difference between this two lines in terms of the range as the other similar graphs I've come across online only show a slight difference. However, the resulted graph has come as a surprise for me as it looks a bit off. In order to make a comparison, I tried to plot a projectile motion without air resistance in the same graph with the same parameters on my own. It has guided me to do the projectile motion with air resistance. I started off by following this exercise. The angle of the trajectory in a given point is the same as the angle that the velocity vector form with the horizontal at that point.I'm simulating the projectile motions with python on Spyder, one with air resistance and one without it. Once the strong> flight time is obtained, simply substitute in the equation of position of the horizontal component. ![]() It is the maximum horizontal distance, from the starting point of the motion to the point in which the body hits the ground. That is, the flight time is the time required for the height to become 0 (the projectile reaches the ground). ![]() It is calculated for y = 0, the vertical component of the position. From that time, and from the equations of position, we can calculate the distance to the origin in the both axes, the x-axis and y-axis. Starting from the equation of velocity in the y-axis, and making v y = 0, we get the time t that it takes the body in get to this height. This value is reached when the velocity in the y-axis, v y , is 0. ![]() On the other hand, frequently in exercises, you would be asked for some of the following values. On the other hand, to know which trajectory the body follows, that is, its equation of trajectory, we can combine the above equations to eliminate t, getting:Īs expected, this is the equation of a parabola. The equation of position of the projectile motion is given by:
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |