Array & plotting

Python untuk Pengguna MATLAB

Justin Kiggins

Product Manager

Array NumPy

  • Array = matriks
  • Array bisa multidimensi
  • Semua elemen bertipe sama
Python untuk Pengguna MATLAB

Pengindeksan pada array NumPy

print(arr)
[[2, 4, 8, 16, 32]]
  • Indeks mulai dari nol
print(arr[2])
8
print(arr[0])
2
print(arr[-1])
32
Python untuk Pengguna MATLAB

Memvisualisasikan data dengan Matplotlib

Contoh visualisasi matplotlib

Python untuk Pengguna MATLAB

Menggunakan matplotlib

import matplotlib.pyplot as plt
# Buat figure baru
plt.figure()

# Plot y terhadap x plt.plot(x, y)
# Atur label sumbu x dan y plt.xlabel('x') plt.ylabel('y')
# Tampilkan plot plt.show()

Python untuk Pengguna MATLAB

Ayo berlatih!

Python untuk Pengguna MATLAB

Preparing Video For Download...