Ball falling plot of position over time with python
<p>I am trying to write a code that will plot the the simulation of a ball being dropped from a height h and make a graph of the position over time using the kinematic equations y = y_0 
My code is this:</p>

<p>from matplotlib.pylab import show, xlabel, ylabel, scatter, plot
from numpy import empty</p>

<pre><code>def drop():

    """
    This function calculates and creates arrays for the velocity at eac time interval as well as the position and plots it. Assuming no drag. 
    """
    #Define the constants in the problem
    h_0 = 10
    g = -9.8 #gravitational constant N
    dt = 0.1 #timestep

    #Now need to create arrays to hold the positins, time, and velocities
    vel = empty(1000,float)
    time = empty(1000,float)
    y = empty(1000,float)

    time[0] = 0
    vel[0] = 0
    y[0] = h_0

    #code for the kinematic equations for the calculation of time, velocity and position
    for i in range of (1000-1):
        time[i+1] = time[i] + dt
        vel[i+1] = vel[i] + (g * dt)
        y[i+1] = time[i] + (vel[i+1] * dt)

        if y[i] &gt; 0:
        #ensures that the graph will not keep going when the ball hits the ground
            break


    plot(time,y, '.')
    xlabel("Time(s)")
    ylabel("Position")
    show()
</code></pre>

<p>However my graph plots three dots one in each corner of the graph when it is supposed to look like a curve, and my graph changes every time which it shouldn't since none of the variables are changing</p>