二维斜率显示 Python

2D slope display Python

问题如下:我必须创建一个矩阵,其值对应于斜坡倾角。角度在 34 度和 28 度之间。我需要创建矩阵并将其显示在图中。

不确定如何创建矩阵。通常你必须计算它或从某个地方加载数据,但绘图看起来像这样:

import matplotlib.pyplot as plt

N = 11
# increase if you like your matrix to be larger, i.e. you like to have a finer mesh
x = np.linspace(0,1,N)
xx, yy = np.meshgrid(x,x)
your_matrix = 34*xx*yy
plt.matshow(your_matrix)
plt.show()