From: Jaime V. <vi...@fe...> - 2024-10-13 09:46:52
|
Hello, On 12/10/24 15:50, 德馬堤 wrote: > > Hello, > > > let matrix M have some data: > > M:matrix([1,2,2],[4,5,3],[7,8,4],[10,11,5])$ > > > In the simplest case the data can be plotted as a 3d colored surface > assuming that the row number equals x, the column number equals to y, > and the data M[x,y] equals to z. > > > How can this be done in general (the matrix could be 1000x1000)? > Perhaps the example given in the manual can help you? M:matrix([1,2,2],[4,5,3],[7,8,4],[10,11,5])$ f(x, y) := float('M [round(x), round(y)])$ plot3d (f(x,y), [x,1,3], [y,1,3], [grid,2,2], nolegend)$ > > A more advanced case is if the row number refers to a specific x > value, and the column number to a specific y value, both given a > lists. E.g. for the above simple matrix: > > X:[1,5,10,20]$ > > Y:[1,5,10]$ > > Sorry. I don't understand how you got those numbers from the M matrix (where did 20 come from?) and what kind of plot you are expecting to get with 4 values of x and only 3 values of y. Regards, Jaime |