0

The question is the following: I have to create a matrix that has values corresponding to the slope inclination. angles between 34 degrees and 28 degrees. I would need to create the matrix and display it in a plot.

Steren
  • 127
  • 2
  • 10

1 Answers1

0

Not sure how to create your matrix. Usually you have to compute it or load the data from somewhere, but plotting would look like this:

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()
Tinu
  • 2,432
  • 2
  • 8
  • 20
  • is there any way to create a descending distribution of values from about 34 degrees to 0 degrees? is there a similar function? – Steren May 09 '20 at 07:54
  • There is a numpy function you can use: `np.linspace(34,0,N)`, where `N` defines how long your array is, basically the size of the interval. – Tinu May 09 '20 at 08:03
  • how can I do to visualize this slope in 2D matrix? – Steren May 09 '20 at 08:08
  • Could you provide a little bit more context to your problem? What exactly do you like your matrix to look like? – Tinu May 09 '20 at 08:21
  • sorry, in fact, I was not clear. I would like a 2D matrix whose values represent the slope of an area. I know the maximum value is around 34 degrees. this value will decrease until it reaches value 0. a sort of decrease in degrees – Steren May 09 '20 at 08:24