Arrays & Plotten

Python für MATLAB-Anwender

Justin Kiggins

Product Manager

NumPy-Arrays

  • Arrays = Matrizen
  • Arrays können mehrdimensional sein
  • Alle Elemente haben denselben Typ
Python für MATLAB-Anwender

Indexierung in NumPy-Arrays

print(arr)
[[2, 4, 8, 16, 32]]
  • Nullbasierte Indizes
print(arr[2])
8
print(arr[0])
2
print(arr[-1])
32
Python für MATLAB-Anwender

Daten mit Matplotlib visualisieren

Beispiel-Matplotlib-Visualisierung

Python für MATLAB-Anwender

Matplotlib verwenden

import matplotlib.pyplot as plt
# Neue Abbildung erstellen
plt.figure()

# y als Funktion von x plotten plt.plot(x, y)
# x- und y-Label setzen plt.xlabel('x') plt.ylabel('y')
# Plot anzeigen! plt.show()

Python für MATLAB-Anwender

Lass uns üben!

Python für MATLAB-Anwender

Preparing Video For Download...