k-Wave Toolbox Previous   Next

makeGrid

Create k-space grid structure

Syntax

kgrid = makeGrid(Nx, dx)
kgrid = makeGrid(Nx, dx, Nz, dz)
kgrid = makeGrid(Nx, dx, Ny, dy, Nz, dz)

Description

makeGrid creates an object of the kWaveGrid class containing the grid coordinates and wavenumber matrices used in k-Wave simulations. The grid structures are indexed as: (x) in 1D; (z, x) in 2D; (z, x, y) in 3D.

Inputs

Nx, Ny, Nz

number of pixels in each Cartesian direction

dx, dy, dz

pixel size in each Cartesian direction [m]

Outputs

kgrid

k-space grid structure used by the simulation and reconstructions functions within k-Wave

The structure kgrid has the following fields:

Fieldname Description

kgrid.k

ND grid of the scalar wavenumber

kgrid.k_max

maximum spatial frequency supported by the grid

kgrid.t_array

evenly spaced array of time values [s] (set to 'auto' by makeGrid)

kgrid.dim

number of spatial dimensions

And for each spatial dimension x, y, z:

Fieldname Description

kgrid.Nx

number of pixels

kgrid.dx

size of an individual pixel [m]

kgrid.x

plaid ND grid of the x coordinate centered about 0 [m]

kgrid.x_vec

1D vector of the x coordinate [m]

kgrid.x_size

length of grid dimension [m]

kgrid.kx

plaid ND grid of the wavenumber components centered about 0

kgrid.kx_max

maximum spatial frequency supported by the grid in the x direction

For example, running kgrid = makeGrid(128, 0.1, 128, 0.1) at the command line will return:

kgrid = 

  kWaveGrid

  Properties:
         Nx: 128
         Ny: 0
         Nz: 128
         dx: 0.1000
         dy: 0
         dz: 0.1000
         kx: [128x128 double]
         ky: 0
         kz: [128x128 double]
          k: [128x128 double]
     kx_max: 31.4159
     ky_max: 0
     kz_max: 31.4159
      k_max: 31.4159
    t_array: 'auto'
        dim: 2
          x: [128x128 double]
          y: 0
          z: [128x128 double]
      x_vec: [1x128 double]
      y_vec: 0
      z_vec: [1x128 double]
     x_size: 12.8000
     z_size: 12.8000
     y_size: 0

Examples

See Also

cart2grid, interpCartData, kspaceFirstOrder1D, kspaceFirstOrder2D, kspaceFirstOrder3D, ndgrid, makeTime, smooth


© 2009, 2010, 2011 Bradley Treeby and Ben Cox.