How to create a 2D-matrix out of my data for surf()?

前端 未结 2 1907
刺人心
刺人心 2021-01-20 04:58

I have a 25000x3-matrix, with each row containing a x-, a y- and a z-value. Now I wanted to do a graphical plot out of these. But for using for example surf(Z) I have to use

2条回答
  •  死守一世寂寞
    2021-01-20 05:21

    The fact that your x- and y- values are not integers is not a problem at all. The real question is: are your (x,y) points forming a grid, or not ?

    • If your points are forming a grid, then you have to reshape your columns to form m-by-n arrays. You may need to sort your data according to the first, then second column and then use the reshape function.

    • If your points are not forming a grid, then you will have to make an interpolation. By chance the scatterinterpolant class can nicely help you in doing so.

提交回复
热议问题