Two angles in degrees are given. From these, I would like to calculate the resulting vector and also to plot it. the modulus / length can be a fixed value. It should start at point 0,0,0
The plot should display the axes as follows:
My current code looks as follows:
import matplotlib.pyplot as plt
import math as Math
alpha = 2
beta = 0
r = 5 # scalar length
x = Math.cos(alpha) * Math.cos(beta) * r;
z = Math.sin(alpha) * Math.cos(beta) * r;
y = Math.sin(beta) * r;
u = [x, y, z]
fig = plt.figure()
ax = plt.axes(projection = '3d')
ax.set_xlim([0,10])
ax.set_ylim([0, 10])
ax.set_zlim([0,10])
start = [0,0,0]
ax.quiver(start[0], start[1], start[2], u[0], u[1], u[2], color='r', linewidth=2)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
ax.set_title('test');
ax.view_init(6,10)
So at the moment I am not sure how to display the coordinate system like in the image. And also I am not sure how to calculate the vector correctly.