Arrays & การพล็อตกราฟ

Python สำหรับผู้ใช้ MATLAB

Justin Kiggins

Product Manager

NumPy arrays

  • Arrays = เมทริกซ์
  • Arrays สามารถเป็นหลายมิติได้
  • ทุก element มีประเภทเดียวกัน
Python สำหรับผู้ใช้ MATLAB

การ index ใน NumPy arrays

print(arr)
[[2, 4, 8, 16, 32]]
  • การ index เริ่มต้นที่ศูนย์
print(arr[2])
8
print(arr[0])
2
print(arr[-1])
32
Python สำหรับผู้ใช้ MATLAB

การแสดงผลข้อมูลด้วย Matplotlib

ตัวอย่างการแสดงผลด้วย matplotlib

Python สำหรับผู้ใช้ MATLAB

การใช้ matplotlib

import matplotlib.pyplot as plt
# Create a new figure
plt.figure()

# Plot y as a function of x plt.plot(x, y)
# Set the x-label and y-label plt.xlabel('x') plt.ylabel('y')
# Be sure to show the plot! plt.show()

Python สำหรับผู้ใช้ MATLAB

มาฝึกกันเถอะ!

Python สำหรับผู้ใช้ MATLAB

Preparing Video For Download...