I'm completely new to MatLab and I might not understand the coding ecosystem that MatLab is built upon. What I'm trying to do is really simple in my mind, but I still don't have the know-how of MatLab to do it efficiently.
Here is my issue: I have a python code that calculates a number z that takes two variables x and y, so z = f(x,y). The x-y plane is a rectangle divided up into many equally spaced points, and z would then be the height over each point when plotted. Accordingly, the data is arranged according to equally spaced coordinates x and y, followed by the corresponding z value. Assume there are N x-values and M y-values, each x-y pair is listed on the same row with its corresponding z-value, so something like:
x1 y1 z11
x1 y2 z12
x1 yM z1M
x2 y1 z21
x2 y2 z22
x2 yM z2M
and so on until the final x-coordinate:
xN y1 zN1
xN y2 zN2
xN yM zNM
So, it's essentially a file with NxM rows and 3 columns, with each number separated by a space.
How do I make a surface plot out of this data, where each (xi,yj) is a point on the x-y plane and the corresponding zij is the height above that point?
I feel a little lost even after consulting the help pages, since none of those seem to apply to my case. Particularly, it seems I don't know how to make the surf command know how to interpred the first two columns as coordinate pairs row-by-row, over which the third column is the corresponding height. Maybe surf or surface are not the right ways to think about this problem?
Any help on this would be greatly appreaciated!