File:Sim-free-fall-plot-matplotlib.svg

Summary

Description
English: plot of a free fall simulation in python created with mathplotlib
Date
Source Own work
Author MikeRun
SVG development
InfoField
Source code
InfoField

Python code

Python matplotlib code
### Simulation Freier Fall

## Konstanten:
g =	       9.81 # m/s² (Fallbeschleunigung Erde)

## Anfangsbedingungen:
h_init = 100    # m    (Anfangshöhe)
v_init =   0    # m/s  (Anfangsgeschwindigkeit)

## Genauigkeit:
dt =       0.2  # s    (Zeitschritt)

list_t = []
list_y = []
y  =  h_init
vy =  v_init
ay = -g
t  =  0
while y > 0:
    list_t.append(t)
    list_y.append(y)
    ay = -g
    y  += vy * dt # Neues y aus dem alten Wert von vy berechnen.
    vy += ay * dt # Neues vy aus dem alten Wert von ay berechnen.
    t  += dt

## Textausgabe:
print("Falldauer: ", round(t,3), " s")
print("Endgeschwindigkeit:", round(vy,3), "m/s")

## Diagramm:
import matplotlib.pyplot as plt
plt.plot(list_t, list_y, 'ro')
plt.ylabel('Höhe (m)')
plt.xlabel('Zeit (s)')
plt.title('Simulation: Freier Fall aus '+str(h_init)+'m')
plt.show()

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
Category:CC-BY-SA-4.0#Sim-free-fall-plot-matplotlib.svg
Category:Self-published work Category:Python (programming language) Category:Simulation Category:Free fall Category:SVG physics
Category:CC-BY-SA-4.0 Category:Free fall Category:Python (programming language) Category:SVG physics Category:Self-published work Category:Simulation Category:Valid SVG created with Python code