Grid Surface
Libraries:
Simscape /
Multibody /
Curves and Surfaces
Description
The Grid Surface block creates a Cartesian grid surface that you can use to model contact
problems. The grid surface has a similar format to the grid generated by the ndgrid
function in MATLAB®. You can use the block to create a surface that represents a square,
rectangular, or non-uniform grid.
To model a grid surface, use the X Grid Vector and Y Grid
Vector parameters to specify the coordinates in the x
and y directions of the grid surface, then use the Z
Heights parameter to specify the elevations of the grid points in the
z direction. The image shows an illustration of a grid surface
whose Z Heights parameter is specified as [0 0 0.5 0.5; 0
0 0.5 0.5; 0 0 0 0; 0 0 0 0]
. The columns of the matrix are along the
x-axis, and the rows of the matrix are along the
y-axis.
To create a grid surface using LiDAR data, you must convert the scattered data to gridded
data before using it in the Grid Surface block. To
convert the data, you can use a scatteredInterpolant
object to create an
interpolant function by using the x, y, and
z values of the LiDAR data, create x and
y grid vectors that represent the domain of the grid, then use
the grid vectors as the query points of the interpolant function to produce
z values of the grid surface. The produced z
values form a matrix in the ndgrid
format that can be used to
specify the Z Heights parameter. You can also use the griddata
function to produce z values for a grid
surface, but you need to transpose the output matrix to the ndgrid
format.
Note
Do not use the
ndgrid
function to create the x and y grid data for a grid surface. Thendgrid
function replicates the input grid vectors into a matrix. Using grid vectors instead of full matrices can save memory.To have the best simulation performance, the spacing in the x and y grid vectors should be as large as possible but small enough to represent the surface with sufficient accuracy. To change the spacing of the grid vectors and compute the corresponding z values , you can use the
griddedInterpolant
object orinterp2
function.
Generally, you need to clean the LiDAR data before converting it to gridded data, such as
removing outliers or NaN values. To clean the data, use the isnan
and isoutlier
functions.
Ports
Frame
Geometry
Parameters
Extended Capabilities
Version History
Introduced in R2021b
See Also
Spatial Contact
Force | Point Cloud | griddata
| isnan
| isoutlier
| scatteredInterpolant
| griddata
| griddedInterpolant
| interp2