jcmwave_loadcartesianfields.mΒΆ

Usage: fieldbag = jcmwave_loadcartesianfields(fileName, [options])

Purpose:
  Loads a tensor fields given on a Cartesian grid stored in .jcm format.

Input:
  fileName -> path to a Cartesian fieldbag in .jcm format.
  options -> key-value list (or matlab structure) used to configure the
    output format. Currently, the only allowed key is 'format' with
    allowed values 'squeeze' (default) and 'full'.


Output: structure consisting of
     fieldbag.X, fieldbag.Y, fieldbag.Z: x, y, z-coordinates of
       the Cartesian grid. Each array X, Y, Z has the size nx*ny*nz,
       where nx, ny, nz are the number of grid points in each direction.
       X, Y, Z has been created by
           >> [X, Y, Z] = ndgrid(x, y, z),
       where x, y, z are the original sampling vectors for the Cartesian
       coordinate directions.
       For a Cartesian field in polar coordinates, XYZ arrays are changed to
       R, Theta and Phi holding the corresponding coordinate values.

     fieldbag.field{j}: array containing the field values.
       fieldbag.field{j}(ix, iy, iz, k) gives the k'th field component at
       the point with coordinates [x(ix), y(iy), z(iz)].

     header: header containing meta-information, i.e. incoming
         field specifcation, permittivities of the lower and upper half

     When 'format' is 'squeeze', singleton dimensions are removed accordingly
     to the commands
       >> X = squeeze(X);
       >> Y = squeeze(Y);
       >> Z = squeeze(Z);
       >> fieldbag{j} = squeeze(fieldbag{j})


Example:
 Plot Cartesian fieldbag on xy-mesh (real part of the z-component of the first
   field is plotted):

   cfb = jcmwave_loadcartesianfields('./project_results/cartesian_xy.jcm');
   surf(cfb.X, cfb.Y, real(cfb.field{1}(:, :, 3)));
   shading interp; view(2); axis equal;