To mesh a grid in MATLAB, use the meshgrid
function.
Here is an example:
main.m173 chars12 lines
This example creates a grid of 50 points in both x and y directions, and then generates a corresponding Z matrix using the sin
function. The mesh
function is then used to generate a 3D mesh plot of the data.
Note that you can adjust the arguments of linspace
to change the size of the grid, and you can use any function you like to generate the Z values.
gistlibby LogSnag