Arrays & plotten

Python voor MATLAB-gebruikers

Justin Kiggins

Product Manager

NumPy-arrays

  • Arrays = matrices
  • Arrays kunnen multidimensionaal zijn
  • Elk element heeft hetzelfde type
Python voor MATLAB-gebruikers

Indexeren in NumPy-arrays

print(arr)
[[2, 4, 8, 16, 32]]
  • Indexering start bij 0
print(arr[2])
8
print(arr[0])
2
print(arr[-1])
32
Python voor MATLAB-gebruikers

Data visualiseren met Matplotlib

Voorbeeldvisualisatie met matplotlib

Python voor MATLAB-gebruikers

Matplotlib gebruiken

import matplotlib.pyplot as plt
# Maak een nieuwe figuur
plt.figure()

# Plot y als functie van x plt.plot(x, y)
# Zet het x- en y-label plt.xlabel('x') plt.ylabel('y')
# Vergeet de plot niet te tonen! plt.show()

Python voor MATLAB-gebruikers

Laten we oefenen!

Python voor MATLAB-gebruikers

Preparing Video For Download...