Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
713 B
2
Indexable
Never
import matplotlib.pyplot as plt
import numpy as np

# Define the vectors
F_net = np.array([2, 0, 4])
a = np.array([1, 0, 2])

# Create a figure and axis
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

# Plot the vectors
ax.quiver(0, 0, 0, F_net[0], F_net[1], F_net[2], color='r', label='F_net (2i + 4k)', arrow_length_ratio=0.1)
ax.quiver(0, 0, 0, a[0], a[1], a[2], color='b', label='a (i + 2k)', arrow_length_ratio=0.1)

# Set the axes limits
ax.set_xlim([0, 3])
ax.set_ylim([0, 3])
ax.set_zlim([0, 5])

# Set the labels
ax.set_xlabel('i')
ax.set_ylabel('j')
ax.set_zlabel('k')

# Add a legend
ax.legend()

# Add a title
plt.title('Net Force and Acceleration Vectors')

# Show the plot
plt.show()
Leave a Comment