# doc-cache created by Octave 11.1.0
# name: cache
# type: cell
# rows: 3
# columns: 67
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
AR_estimate


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1038
 [val_ar t_ar f_val_ar  EC] = AR_estimate( t, val, freq, < nu, mu, expand_factor >)

 apply autoregressive signal model to improve dft results

 t     : time vector
 val   : time domain values
 freq  : frequency vector for dft

 optional
 nu    : AR order (default 40)
 mu    : number of timesteps to train the model (default 3*nu)
 expand_factor : increase signal length by this factor (default 5)

 return values:
 val_ar:   AR estimated time signal
 t_ar:     time vector
 f_val_ar: FD transformed AR estimated signal
 EC:       error code
           0 --> no error
           1 --> input error: t and val mismatch
           2 --> input error: mu has to be larger than 2*nu
           3 --> input error: expand_factor has to be larger than 1
           10 --> AR error: signal is to short for AR estimate --> decrease AR order
           11 --> AR error: estimated signal appears to be unstable --> use a different mu

 openEMS matlab interface
 -----------------------
 Author: Thorsten Liebig, 2011

 See also ReadUI, DFT_time2freq



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [val_ar t_ar f_val_ar  EC] = AR_estimate( t, val, freq, < nu, mu, expand_fac...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
Add2Queue


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 292
 function [queue] = Add2Queue(queue,func_name, func_args, varargin)

 Use this function to add a function to the queue.

 For more details see: InitQueue

 See also: InitQueue, FinishQueue, ResultsQueue, RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
 function [queue] = Add2Queue(queue,func_name, func_args, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
AddCPWPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2534
 [CSX,port] = AddCPWPort( CSX, prio, portnr, materialname, start, stop, gap_width, dir, evec, varargin )

 CSX:          CSX-object created by InitCSX()
 prio:         priority for excitation and probe boxes
 portnr:       (integer) number of the port
 materialname: property for the CPW (created by AddMetal())
 start:        3D start rowvector for port definition
 stop:         3D end rowvector for port definition
 gap_width:    width of the CPW gap (left and right)
 dir:          direction of wave propagation (choices: 0, 1, 2 or 'x','y','z')
 evec:         excitation vector, which defines the direction of the e-field (must be the same as used in AddExcitation())

 variable input:
  varargin:    optional additional excitations options, see also AddExcitation
 'ExcitePort'  true/false to make the port an active feeding port (default
               is false)
 'FeedShift'   shift to port from start by a given distance in drawing
               units. Default is 0. Only active if 'ExcitePort' is set!
 'Feed_R'      Specify a lumped port resistance. Default is no lumped
               port resistance --> port has to end in an ABC.
 'MeasPlaneShift'  Shift the measurement plane from start t a given distance
               in drawing units. Default is the middle of start/stop.
 'PortNamePrefix' a prefix to the port name

 Important: The mesh has to be already set and defined by DefineRectGrid!

 example:
   CSX = AddMetal( CSX, 'metal' ); %create a PEC called 'metal'
   start = [0       -width/2  0];
   stop  = [length  +width/2  0];
   [CSX,port] = AddCPWPort( CSX, 0, 1, 'metal', start, stop, gap_width, 'x', ...
                                   [0 0 -1], 'ExcitePort', true, 'Feed_R', 50 )
 Explanation:
   - this defines a stripline in x-direction (dir='x')
     --> the wave travels along the x-direction
   - with an e-field excitation in -z-direction (evec=[0 0 -1])
   - the excitation is active and placed at x=start(1) ('ExcitePort', true)
   - a 50 Ohm lumped port resistance is placed at x=start(1) ('Feed_R', 50)
   - the width-direction is determined by the cross product of the
       direction of propagtion (dir='x') and the excitation vector
       (evec=[0 0 -1]), in this case it is the y-direction
   - the stripline-metal is created in a xy-plane at a height at z=start(3)
     --> The upper and lower reference plane (ground) must be defined by
     the user

 Thorsten Liebig <thorsten.liebig@gmx.de> (c) 2014

 See also InitCSX DefineRectGrid AddMetal AddMaterial AddExcitation calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [CSX,port] = AddCPWPort( CSX, prio, portnr, materialname, start, stop, gap_w...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
AddCircWaveGuidePort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1485
 function [CSX,port] = AddCircWaveGuidePort( CSX, prio, portnr, start, stop, radius, mode_name, pol_ang, exc_amp, varargin )
 
 Create a circular waveguide port, including an optional excitation and probes
 
 Note: - The excitation will be located at the start position in the given direction
       - The voltage and current probes at the stop position in the given direction

 input:
   CSX:        complete CSX structure (must contain a mesh)
   prio:       priority of primitives
   start:      start coordinates of waveguide port box
   stop:       stop  coordinates of waveguide port box
   radius:     circular waveguide radius (in meter)
   mode_name:  mode name, e.g. 'TE11' or 'TM21'
   pol_ang:    polarization angle (e.g. 0 = horizontal, pi/2 = vertical)
   exc_amp:    excitation amplitude (set 0 to be passive)

 optional (key/values):
   varargin:   optional additional excitations options, see also AddExcitation
   'PortNamePrefix': a prefix to the port name

 output:
   CSX:        modified CSX structure
   port:       port structure to use with calcPort

 example:
   % create a TE11 circular waveguide mode, using cylindircal coordinates
   start=[mesh.r(1)   mesh.a(1)   0  ];
   stop =[mesh.r(end) mesh.a(end) 100];
   [CSX,port] = AddCircWaveGuidePort( CSX, 99, 1, start, stop, 320e-3, 'TE11', 0, 1);

 openEMS matlab interface
 -----------------------
 (c) 2013 Thorsten Liebig (thorsten.liebig@gmx.de)

 See also InitCSX, AddExcitation, calcWGPort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function [CSX,port] = AddCircWaveGuidePort( CSX, prio, portnr, start, stop, ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
AddCoaxialPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1777
 function [CSX,port] = AddCoaxialPort( CSX, prio, portnr, pec_name, materialname, start, stop, dir, r_i, r_o, r_os, varargin )

 CSX:          CSX-object created by InitCSX()
 prio:         priority for excitation and probe boxes
 portnr:       (integer) number of the port
 pec_name:     metal property for coaxial inner/outer conductor (created by AddMetal())
 materialname: substrate property for coaxial line (created by AddMaterial())
               Note: this may be empty for an "air filled" coaxial line
 start:        3D start rowvector for coaxial cable axis
 stop:         3D end rowvector for coaxial cable axis
 dir:          direction of wave propagation (choices: 0, 1, 2 or 'x','y','z')
 r_i:          inner coaxial radius (in drawing unit)
 r_o:          outer coaxial radius (in drawing unit)
 r_os:         outer shell coaxial radius (in drawing unit)

 variable input:
  varargin:    optional additional excitations options, see also AddExcitation
 'ExciteAmp'   excitation amplitude of transversal electric field profile,
               set to 0 (default) for a passive port
 'FeedShift'   shift to port from start by a given distance in drawing
               units. Default is 0. Only active if 'ExciteAmp' is set!
 'Feed_R'      Specify a lumped port resistance. Default is no lumped
               port resistance --> port has to end in an ABC.
 'MeasPlaneShift'  Shift the measurement plane from start t a given distance
               in drawing units. Default is the middle of start/stop.
 'PortNamePrefix' a prefix to the port name

 the mesh must be already initialized

 example:

 openEMS matlab interface
 -----------------------
 Thorsten Liebig <thorsten.liebig@gmx.de> (c) 2013

 See also InitCSX AddMetal AddMaterial AddExcitation calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function [CSX,port] = AddCoaxialPort( CSX, prio, portnr, pec_name, materialn...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
AddCurvePort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1036
[CSX,port] = AddCurvePort( CSX, prio, portnr, R, start, stop [, excite, varargin] )

 Creates a curve port (1-dimensional).
 The mesh must already be initialized.

 input:
   CSX:    CSX-object created by InitCSX()
   prio:   priority for excitation, metal, sheet and probe boxes
   portnr: (integer) number of the port
   R:      internal resistance of the port
   start:  3D start rowvector for port definition
   stop:   3D end rowvector for port definition
   excite (optional): if true, the port will be switched on (see AddExcitation())
                       Note: for legacy support a string will be accepted
 optional (key/values):
   varargin:   optional additional excitations options, see also AddExcitation
   'PortNamePrefix': a prefix to the port name

 output:
   CSX:
   port:

 example:
   start = [0 0 0]; stop = [0 0 12];
   this defines a lumped port in z-direction
   the excitation/probe is placed between start(1) and stop(1)

 (C) 2010 Sebastian Held <sebastian.held@uni-due.de>
 See also InitCSX AddExcitation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
[CSX,port] = AddCurvePort( CSX, prio, portnr, R, start, stop [, excite, varar...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
AddLumpedPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1397
 [CSX, port] = AddLumpedPort( CSX, prio, portnr, R, start, stop, dir, excite, varargin )

 Add a lumped port as an excitation.

 A lumped port consists of an excitation, a lumped resistor, a voltage and
 current probe.

 CSX:      CSX-object created by InitCSX()
 prio:     priority for substrate and probe boxes
 portnr:   (integer) number of the port
 R:        internal resistance of the port (lumped element)
 start:    3D start rowvector for port definition
 stop:     3D end rowvector for port definition
 dir:      direction/amplitude of port (e.g.: [1 0 0], [0 1 0] or [0 0 1])
 excite (optional): if true, the port will be switched on (see AddExcitation())
                       Note: for legacy support a string will be accepted
 V_Probe_Weight:  additional weight for the voltage probes
 I_Probe_Weight:  additional weight for the current probes
 optional (key/values):
   'PortNamePrefix': an prefix to the port name
 varargin (optional): additional excitations options, see also AddExcitation

 example:
   start = [0 -width/2 0];
   stop  = [0  width/2 height];
   [CSX] = AddLumpedPort(CSX, 5 ,1 , 50, start, stop, [0 0 1], true);
   %this defines an active lumped port in z-direction with a 50 Ohm port impedance

 openEMS matlab interface
 -----------------------
 Sebastian Held <sebastian.held@gmx.de>
 Jun 1 2010
 Thorsten Liebig
 Jul 13 2011

 See also InitCSX AddExcitation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [CSX, port] = AddLumpedPort( CSX, prio, portnr, R, start, stop, dir, excite,...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
AddMRStub


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 867
 CSX = AddMRStub( CSX, materialname, prio, MSL_width, len, alpha,
 resolution, orientation, normVector, position )

 Microstrip Radial Stub

 CSX: CSX-object created by InitCSX()
 materialname: property for the MSL (created by AddMetal() or AddMaterial())
 prio: priority
 MSL_width: width of the MSL to connect the stub to
 len: length of the radial stub
 alpha: angle subtended by the radial stub (degrees) 
 resolution: discrete angle spacing (degrees)
 orientation: angle of main direction of the radial stub (degrees)
 normVector: normal vector of the stub
 position: position of the end of the MSL

 This radial stub definition is equivalent to the one Agilent ADS uses.

 example:
 CSX = AddMRStub( CSX, 'PEC', 10, 1000, 5900, 30, 1, -90, [0 0 1], [0 -10000 254] );


 Sebastian Held <sebastian.held@gmx.de>
 Jun 1 2010

 See also InitCSX AddMetal AddMaterial



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 CSX = AddMRStub( CSX, materialname, prio, MSL_width, len, alpha,
 resolution...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
AddMSLPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2647
 [CSX,port] = AddMSLPort( CSX, prio, portnr, materialname, start, stop, dir, evec, varargin )

 CSX:          CSX-object created by InitCSX()
 prio:         priority for excitation and probe boxes
 portnr:       (integer) number of the port
 materialname: property for the MSL (created by AddMetal())
 start:        3D start rowvector for port definition
 stop:         3D end rowvector for port definition
 dir:          direction of wave propagation (choices: 0, 1, 2 or 'x','y','z')
 evec:         excitation vector, which defines the direction of the e-field (must be the same as used in AddExcitation())
 
 variable input:
  varargin:    optional additional excitations options, see also AddExcitation
 'ExcitePort'  true/false to make the port an active feeding port (default
               is false)
 'FeedShift'   shift to port from start by a given distance in drawing
               units. Default is 0. Only active if 'ExcitePort' is set!
 'Feed_R'      Specify a lumped port resistance. Default is no lumped
               port resistance --> port has to end in an ABC.
 'MeasPlaneShift'  Shift the measurement plane from start t a given distance 
               in drawing units. Default is the middle of start/stop.
 'PortNamePrefix' a prefix to the port name
 
 Important: The mesh has to be already set and defined by DefineRectGrid!

 example:
   CSX = AddMetal( CSX, 'metal' ); %create a PEC called 'metal'
   start = [0       -width/2  height];
   stop  = [length  +width/2  0     ];
   [CSX,port] = AddMSLPort( CSX, 0, 1, 'metal', start, stop, 'x', [0 0 -1], ...
                           'ExcitePort', true, 'Feed_R', 50 )
 Explanation:
   - this defines a MSL in x-direction (dir='x')
     --> the wave travels along the x-direction
   - with an e-field excitation in -z-direction (evec=[0 0 -1])
   - the excitation is active and placed at x=start(1) ('ExcitePort', true)
   - a 50 Ohm lumped port resistance is placed at x=start(1) ('Feed_R', 50)
   - the width-direction is determined by the cross product of the
       direction of propagation (dir='x') and the excitation vector
       (evec=[0 0 -1]), in this case it is the y-direction
   - the MSL-metal is created in a xy-plane at a height at z=start(3)
     --> It is important to define the MSL height in the start coordinate!
   - the ground (xy-plane, not defined by the port) is assumed at z=stop(3)
     --> The reference plane (ground) is defined in the stop coordinate!

 Sebastian Held <sebastian.held@gmx.de> May 13 2010
 Thorsten Liebig <thorsten.liebig@gmx.de> (c) 2011-2013

 See also InitCSX DefineRectGrid AddMetal AddMaterial AddExcitation calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [CSX,port] = AddMSLPort( CSX, prio, portnr, materialname, start, stop, dir, ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
AddPML


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1208
 mesh = AddPML( mesh, numcells, <CoordSystem>  )

 Adds equidistant cells to the specified directions of the simulation
 area. This is used to put a PML (perfectly matched layer) absorber there.
 Remember: this function only adds space for the PML, the boundary
 conditions need to be set correctly to really add PML material.

 The mesh is sorted and duplicate lines are removed.

 input:
   mesh:     mesh structure
   numcells: 1x6 vector (xmin,xmax,ymin,ymax,zmin,zmax) with number of
             cells to add to this direction
   CoordSystem (optional): set to 1 in case of cylindrical mesh using
               mesh.r, mesh.a and mesh.z

 output:
   mesh:     new mesh with the added lines

 example:
   % some fixed mesh lines
   mesh.x = [-100 0 100];
   mesh.y = [-100 0 100];
   mesh.z = [0 500];
   mesh = DetectEdges(CSX, mesh); %detect edges
   mesh = SmoothMesh(mesh, c0/fmax/20/unit); % smooth the mesh

   mesh = AddPML(mesh, 8); % add 8 lines to all directions
   % or
   mesh = AddPML(mesh, [0 0 0 0 8 8]); % add 8 lines in both z-directions

 See also DefineRectGrid, SmoothMesh, DetectEdges

 openEMS matlab interface
 -----------------------
 Sebastian Held <sebastian.held@uni-due.de>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 mesh = AddPML( mesh, numcells, <CoordSystem>  )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
AddRectWaveGuidePort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1488
 function [CSX,port] = AddRectWaveGuidePort( CSX, prio, portnr, start, stop, dir, a, b, mode_name, exc_amp, varargin )
 
 Create a rectangular waveguide port, including an optional excitation and probes
 
 Note: - The excitation will be located at the start position in the given direction
       - The voltage and current probes at the stop position in the given direction

 input:
   CSX:        complete CSX structure (must contain a mesh)
   prio:       priority of primitives
   start:      start coordinates of waveguide port box
   stop:       stop  coordinates of waveguide port box
   dir:        direction of port (0/1/2 or 'x'/'y'/'z'-direction)
   a,b:        rectangular waveguide width and height (in meter)
   mode_name:  mode name, e.g. 'TE11' or 'TM21'
   exc_amp:    excitation amplitude (set 0 to be passive)

 optional (key/values):
   varargin:   optional additional excitations options, see also AddExcitation
   'PortNamePrefix': a prefix to the port name

 output:
   CSX:        modified CSX structure
   port:       port structure to use with calcPort

 example:
   % create a TE10 circular waveguide mode, using cylindircal coordinates
   start=[mesh.r(1)   mesh.a(1)   0  ];
   stop =[mesh.r(end) mesh.a(end) 100];
   [CSX,port] = AddCircWaveGuidePort( CSX, 99, 1, start, stop, 320e-3, 'TE11', 0, 1);

 openEMS matlab interface
 -----------------------
 (c) 2013 Thorsten Liebig (thorsten.liebig@gmx.de)

 See also InitCSX, AddExcitation, calcWGPort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function [CSX,port] = AddRectWaveGuidePort( CSX, prio, portnr, start, stop, ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
AddStripLinePort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2549
 [CSX,port] = AddStripLinePort( CSX, prio, portnr, materialname, start, stop, height, dir, evec, varargin )

 CSX:          CSX-object created by InitCSX()
 prio:         priority for excitation and probe boxes
 portnr:       (integer) number of the port
 materialname: property for the stripline (created by AddMetal())
 start:        3D start rowvector for port definition
 stop:         3D end rowvector for port definition
 height:       height of the stripline (top and bottom)
 dir:          direction of wave propagation (choices: 0, 1, 2 or 'x','y','z')
 evec:         excitation vector, which defines the direction of the e-field (must be the same as used in AddExcitation())

 variable input:
  varargin:    optional additional excitations options, see also AddExcitation
 'ExcitePort'  true/false to make the port an active feeding port (default
               is false)
 'FeedShift'   shift to port from start by a given distance in drawing
               units. Default is 0. Only active if 'ExcitePort' is set!
 'Feed_R'      Specify a lumped port resistance. Default is no lumped
               port resistance --> port has to end in an ABC.
 'MeasPlaneShift'  Shift the measurement plane from start t a given distance
               in drawing units. Default is the middle of start/stop.
 'PortNamePrefix' a prefix to the port name

 Important: The mesh has to be already set and defined by DefineRectGrid!

 example:
   CSX = AddMetal( CSX, 'metal' ); %create a PEC called 'metal'
   start = [0       -width/2  0];
   stop  = [length  +width/2  0];
   [CSX,port] = AddStripLinePort( CSX, 0, 1, 'metal', start, stop, height, 'x', ...
                                   [0 0 -1], 'ExcitePort', true, 'Feed_R', 50 )
 Explanation:
   - this defines a stripline in x-direction (dir='x')
     --> the wave travels along the x-direction
   - with an e-field excitation in -z-direction (evec=[0 0 -1])
   - the excitation is active and placed at x=start(1) ('ExcitePort', true)
   - a 50 Ohm lumped port resistance is placed at x=start(1) ('Feed_R', 50)
   - the width-direction is determined by the cross product of the
       direction of propagtion (dir='x') and the excitation vector
       (evec=[0 0 -1]), in this case it is the y-direction
   - the stripline-metal is created in a xy-plane at a height at z=start(3)
     --> The upper and lower reference plane (ground) must be defined by
     the user

 Thorsten Liebig <thorsten.liebig@gmx.de> (c) 2013

 See also InitCSX DefineRectGrid AddMetal AddMaterial AddExcitation calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [CSX,port] = AddStripLinePort( CSX, prio, portnr, materialname, start, stop,...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
AddWaveGuidePort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2256
 function [CSX,port] = AddWaveGuidePort( CSX, prio, portnr, start, stop, dir, E_WG_func, H_WG_func, kc, exc_amp, varargin )
 
 Create a waveguide port, including an optional excitation and probes
 
 Note: - The excitation will be located at the start position in the given direction
       - The voltage and current probes at the stop position in the given direction

 parameter:
   CSX:        complete CSX structure (must contain a mesh)
   prio:       priority of primitives
   start:      start coordinates of waveguide port box
   stop:       stop  coordinates of waveguide port box
   dir:        direction of port (0/1/2 or 'x'/'y'/'z'-direction)
   E_WG_func:  electric field mode profile function as a string
   H_WG_func:  magnetic field mode profile function as a string
   kc:         cutoff wavenumber (defined by the waveguide dimensions)
   exc_amp:    excitation amplitude (set 0 to be passive)

 optional (key/values):
   varargin:   optional additional excitations options, see also AddExcitation
   'PortNamePrefix': a prefix to the port name

 output:
   CSX:        modified CSX structure
   port:       port structure to use with calcPort

 example:
   % create a TE11 circular waveguide mode, using cylindircal coordinates
   p11 = 1.841;
   kc = p11 / radius;  % cutoff wavenumber with radius in meter
   kc_draw = kc*unit;  % cutoff wavenumber in drawing units

   % electric field mode profile
   func_E{1} = [ num2str(-1/kc_draw^2,15) '/rho*cos(a)*j1('  num2str(kc_draw,15) '*rho)'];
   func_E{2} = [ num2str(1/kc_draw,15) '*sin(a)*0.5*(j0('  num2str(kc_draw,15) '*rho)-jn(2,'  num2str(kc_draw,15) '*rho))'];
   func_E{3} = 0;

   % magnetic field mode profile
   func_H{1} = [ '-1*' num2str(1/kc_draw,15) '*sin(a)*0.5*(j0('  num2str(kc_draw,15) '*rho)-jn(2,'  num2str(kc_draw,15) '*rho))'];
   func_H{2} = [ num2str(-1/kc_draw^2,15) '/rho*cos(a)*j1('  num2str(kc_draw,15) '*rho)'];
   func_H{3} = 0;

   start=[mesh.r(1)   mesh.a(1)   0  ];
   stop =[mesh.r(end) mesh.a(end) 100];
   [CSX, port{1}] = AddWaveGuidePort(CSX, 0, 1, start, stop, 2, func_E, func_H, kc, 1);

 openEMS matlab interface
 -----------------------
 (c) 2013 Thorsten Liebig (thorsten.liebig@gmx.de)

 See also InitCSX, AddExcitation, calcWGPort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function [CSX,port] = AddWaveGuidePort( CSX, prio, portnr, start, stop, dir,...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
AnalyzeNF2FF


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1064
 [E_theta,E_phi,Prad,Dmax] = AnalyzeNF2FF( Sim_Path, filenames_E, filenames_H, f, theta, phi, r )

 calculates the farfield via a near field to far field transformation

 input:
   Sim_Path:    simulation directory
   nf2ff:       structure on filenames etc. as created by CreateNF2FFBox 
   f:           frequency (Hz) for far field calculation
   theta:       (degrees) vector of discrete theta values to calculate the far field for
   phi:         (degrees) vector of discrete phi values to calculate the far field for
   r:           (optional) Radius (m) at which the E-fields are calculated (default: 1 m)

 output:
   E_theta:     E_theta(theta,phi); theta component of the electric field strength at radius r
   E_phi:       E_phi(theta,phi);     phi component of the electric field strength at radius r
   Prad:        time averaged radiated power
   Dmax:        maximum directivity

 example:
   see examples/NF2FF/infDipol.m

 See also CreateNF2FFBox

 (C) 2010 Sebastian Held <sebastian.held@gmx.de>
 (C) 2011 Thorsten Liebig <thorsten.liebig@gmx.de>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [E_theta,E_phi,Prad,Dmax] = AnalyzeNF2FF( Sim_Path, filenames_E, filenames_H...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
CalcNF2FF


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1652
 function nf2ff = CalcNF2FF(nf2ff, Sim_Path, freq, theta, phi, varargin)

 Calculate the near-field to far-field transformation created by
 CreateNF2FFBox

 IMPORTANT:
 Make sure to define the correct nf2ff phase center, aka. central antenna
 position! See optional parameter below!! Default is [0 0 0]

 parameter:
 nf2ff:    data structure created by CreateNF2FFBox
 Sim_Path: path to simulation data
 freq:     array of frequencies to analyse
 theta,phi: spherical coordinates to evaluate the far-field on (in radians)

 optional parameter:
 'Center': nf2ff phase center, default is [0 0 0]
           !! Make sure the center is never outside of your nf2ff box!!
           Definition is the correct coordinate system necessary
           --> either Cartesian or cylindrical coordinates
 'Mode':   'Mode', 0 -> read only, if data already exist (default)
           'Mode', 1 -> calculate anyway, overwrite existing
           'Mode', 2 -> read only, fail if not existing
 'Outfile': alternative nf2ff result hdf5 file name
            default is: <nf2ff.name>.h5
 'Verbose': set verbose level for the nf2ff calculation 0-2 supported
 'Radius':  specify the radius for the nf2ff
 'Eps_r':   specify the relative electric permittivity for the nf2ff
 'Mue_r':   specify the relative magnetic permeability for the nf2ff

 'Mirror':  Add mirroring in a given direction (dir), with a given 
            mirror type (PEC or PMC) and a mirror position in the given
            direction.
            Example: 'Mirror', {0, 'PMC', +100}

 See also: CreateNF2FFBox, ReadNF2FF

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig, 2012



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
 function nf2ff = CalcNF2FF(nf2ff, Sim_Path, freq, theta, phi, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
CheckQueue


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 408
 function [queue running] = CheckQueue(queue, <query_time>)

 Check the given queue for finished tasks.

 Parameter:
   query_time (optional): time interval to check for finished tasks
                          (in seconds, default is 5)

 For more details see: InitQueue

 See also: InitQueue, ResultsQueue, Add2Queue, RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 59
 function [queue running] = CheckQueue(queue, <query_time>)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
ConvertHDF5_VTK


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 876
 ConvertHDF5_VTK(hdf_file, vtk_prefix, varargin)

 Convert openEMS field data stored in the given hdf5 file to a vtk file.

 arguments:
   hdf_file:   source hdf5 file
   vtk_prefix: output vtk files prefix

 optional arguments:
   'TD_Dump':  activate dump for time-domain data (default is off)
   'FD_Dump':  activate dump for frequency-domain data (default is on)
   'NumPhase': number of phase to dump frequency domain data animation
               (default is 36 --> 10°)
   'FieldName': field name written to vtk, e.g. 'E-Field'
   'weight':   field weighting

   for more optional augments have a look at ReadHDF5Dump

 example:
   % read time-domian data from hdf5, perform dft and dump as vtk
   ConvertHDF5_VTK('Et.h5','Ef','NumPhase',18,'Frequency',1e9)

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Dump Dump2VTK



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 ConvertHDF5_VTK(hdf_file, vtk_prefix, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
CreateNF2FFBox


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1166
 function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, varargin)

 create the dump boxes needed for the near field to far field transformation
 
 input:
   name:       name of this nf2ff box
   start/stop: start/stop coordinates for the nf2ff box (this box has to
               enclose all radiating structures!)
 optional inputs:
   'Directions': enable/disable specific directions, e.g.
                 'Directions',[1 1 0 0 1 1]
                   -> disable nf2ff in +/-y direction
   'Frequency': dump nf2ff in frequency domain, this will save disk-space
                but is less flexible, since only this frequencies can be
                used for the nf2ff calculations by CalcNF2FF
                See also AddDump for more information
   'OptResolution': specify a dump resolution, this will save disk-space
                    See also AddDump for more information
                    e.g.: 'OptResolution', c0/max_freq/unit/15

 example:
   see Tutorials/Simple_Patch_Antenna.m
   see Tutorials/Helical_Antenna.m
 
 See also CalcNF2FF

 (C) 2010 Sebastian Held <sebastian.held@gmx.de>
 (C) 2010-2012 Thorsten Liebig <thorsten.liebig@gmx.de>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
 function [CSX nf2ff] = CreateNF2FFBox(CSX, name, start, stop, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
DFT_time2freq


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 532
 f_val = DFT_time2freq( t, val, freq, signal_type )

 computes the DFT at the given frequencies

 parameter:
 t  : time vector
 val: data vector
 freq: DFT frequency vector
 signal_type: 'pulse' (default), 'periodic'

 return values:
 f_val:  single-sided spectrum

 example:
   t=linspace(0,1,100);
   t_val=0.9*sin(2*pi*3*t); % sine wave; amplitude 0.9; frequency 3 Hz
   f=linspace(1,5,101);
   f_val=DFT_time2freq( t, t_val, f, 'periodic' );
   interp1(f,abs(f_val),3)
 ans = 0.8910
   plot( t, t_val )
   plot( f, abs(f_val) )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
 f_val = DFT_time2freq( t, val, freq, signal_type )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
DelayFidelity


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1629
 [delay, fidelity] = DelayFidelity(nf2ff, port, path, weight_theta, weight_phi, theta, phi, f_lo, f_hi, varargin)
 
 
 This function calculates the time delay from the source port to the phase center of the antenna and the fidelity. 
 The fidelity is the similarity between the excitation pulse and the radiated pulse (normalized scalar product).
 The resolution of the delay will be equal to or better than ((f_0 + f_c)*Oversampling)^-1 when using Gaussian excitation.
 Oversampling is an input parameter to InitFDTD. The rows of delay and fidelity correspond to theta and the columns to phi.
 
 input:
   nf2ff: return value of CreateNF2FFBox.
   port: return value of AddLumpedPort
   path: path of the simulation results.
   weight_theta: weight of the E_theta component 
   weight_phi: weight of the E_phi component
     -> with both (possibly complex) parameters any polarization can be examined
   theta: theta values to be simulated
   phi: phi values to be simulated
   f_0: center frequency of SetGaussExcite
   f_c: cutoff frequency of SetGaussExcite

 variable input:
   'Center': phase center of the antenna for CalcNF2FF
   'Radius': radius for CalcNF2FF
   'Mode': mode CalcNF2FF
   
 example:
   theta = [-180:10:180] * pi / 180;
   phi = [0, 90] * pi / 180;
   % use circular right handed polarization
   [delay, fidelity] = DelayFidelity2(nf2ff, port, Sim_Path, -1i, 1, theta, phi, f_0, f_c, 'Mode', 1);
   figure
   polar(theta.', delay(:,1) * 3e11); % delay in mm
   figure
   polar(theta', (fidelity(:,1)-0.95)/0.05); % last 5 percent of fidelity
 
 Author: Georg Michel 



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [delay, fidelity] = DelayFidelity(nf2ff, port, path, weight_theta, weight_ph...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
Dump2VTK


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 515
 Dump2VTK(filename, fields, mesh, fieldname, varargin)

   Dump fields extracted from an hdf5 file to a vtk file format

   possible arguments:
       'NativeDump': 0 (default) / 1, dump in native coordinate system
       'CloseAlpha': 0 (default) / 1, repeat first/last line in
                     alpha-direction for a full cylindrical mesh

   example:


 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5FieldData ReadHDF5Mesh GetField_TD2FD GetField_Interpolation



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 Dump2VTK(filename, fields, mesh, fieldname, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
DumpFF2VTK


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1003
  DumpFF2VTK(filename, farfield, thetaRange, phiRange, varargin)

  Dump 3D far field pattern to a vtk file

 input:
   filename:      filename of VTK file, existing file will be overwritten
   farfield:      far field in V/m
   thetaRange:    theta range in deg
   phiRange:      phi range in deg

 variable input:
   'scale':       - linear scale of plot, doesn't affect gain values
   'logscale':    - if set, show far field with logarithmic scale
                  - set the dB value for point of origin
                  - values below will be clamped
   'maxgain':     - add max gain in dB to normalized far field
                  - only valid if logscale is set
                  - default is 0dB

   example:
       DumpFF2VTK(filename, farfield, thetaRange, phiRange, ...
                    'scale', 2, 'logscale', -20, 'maxgain', 3)

       see also examples/NF2FF/infDipol.m

 See also CreateNF2FFBox, CalcNF2FF
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
  DumpFF2VTK(filename, farfield, thetaRange, phiRange, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
FFT_time2freq


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 117
 [f,val] = FFT_time2freq( t, val )

 Note: This function can only be used for pulse signals

 See also DFT_time2freq



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 34
 [f,val] = FFT_time2freq( t, val )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
FindFreeSSH


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 517
 function host = FindFreeSSH(host_list, Settings, wait_time, command)
 
 Find a free ssh host not running openEMS
 
 internal function used by RunOpenEMS
 
 host_list: give a list of possible host
 
 wait_time: wait x seconds after not finding a free host and rechecking
            default: 600 seconds
 
 command: unix command to check for free host (empty result --> free)
          default: 'ps -e | grep openEMS'

 See also RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function host = FindFreeSSH(host_list, Settings, wait_time, command)
 
 Find...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
FinishQueue


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 395
 function [queue] = FinishQueue(queue, <query_time>)

 Wait for the given queue to finish.

 Parameter:
   query_time (optional): time interval to check for finished tasks
                          (in seconds, default is 5)

 For more details see: InitQueue

 See also: InitQueue, ResultsQueue, Add2Queue, RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
 function [queue] = FinishQueue(queue, <query_time>)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22
GetField_Interpolation


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 960
 [field_i mesh_i] = GetField_Interpolation(field, mesh, lines, varargin)

   Get an interpolated field, e.g. read by ReadHDF5Dump 
 
   homogeneous interpolation given by a 3x1 vector: e.g. [21,1,101]
 
   arbitrary interpolation on a given mesh:
               e.g.:   mesh_interp{1} = linspace(0,  1,101) * 1e-3;
                       mesh_interp{2} = linspace(0,0.5, 51) * 1e-3;
                       mesh_interp{3} = linspace(0,0.2, 21) * 1e-3;
 
   example:
   [field mesh] = ReadHDF5Dump('Et.h5');
   %interpolate on a mesh with 21x21x101 lines
   [field_i mesh_i] = GetField_Interpolation(field, mesh, [21 21 101]);
   or
   [field_i mesh_i] = GetField_Interpolation(field, mesh, mesh_interp);
   
   %or both steps in one with the same result:
   [field_i mesh_i] = ReadHDF5Dump('Et.h5','Interpolation', [21 21 101]);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Dump ReadHDF5FieldData ReadHDF5Mesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 72
 [field_i mesh_i] = GetField_Interpolation(field, mesh, lines, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
GetField_Range


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 753
 [field_i mesh_i] = GetField_Range(field, mesh, range)

   Get a field dump subset within a given mesh range 
 
   example:
       % specify a mesh range
       range{1} = [0 150] * 1e-3;  % x in range 0..150mm
       range{2} = [0];             % only one line close to y==0
       range{3} = [];              % no range restriction
 
       % read hdf data
       [field mesh] = ReadHDF5Dump('Et.h5');
       % extract a ranged subset
       [field_i mesh_i] = GetField_Range(field, mesh, range);
     
       %or both steps in one with the same result:
       [field_i mesh_i] = ReadHDF5Dump('Et.h5','Range', range);
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Dump ReadHDF5FieldData ReadHDF5Mesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 54
 [field_i mesh_i] = GetField_Range(field, mesh, range)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20
GetField_SubSampling


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 339
 [field_i mesh_i] = GetField_SubSampling(field, mesh, subsampling, varargin)

   Get a sub-sampled field, e.g. read by ReadHDF5Dump

   sub-sampling e.g. skipping every second line in x/r direction: [2 1 1]

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Dump ReadHDF5FieldData ReadHDF5Mesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 76
 [field_i mesh_i] = GetField_SubSampling(field, mesh, subsampling, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
GetField_TD2FD


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 428
 function field = GetField_TD2FD(field, freq)

 Transforms time-domain field data into the frequency domain
 Auto-corrects the half-timestep offset of the H-field
 
 example:
   freq = linspace(0,1e9,100); %target frequency vector (Hz)
   field = ReadHDF5FieldData('tmp/Ht.h5');
   field_FD = GetField_TD2FD(field, freq);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5FieldData



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 45
 function field = GetField_TD2FD(field, freq)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
InitCylindricalFDTD


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 366
 function FDTD = InitCylindricalFDTD(NrTS, endCrit, varargin)

 see also InitFDTD

 e.g FDTD = InitCylindricalFDTD(5e5,1e-6,'OverSampling',10)
 
 WARNING: This function is depreciated, use InitFDTD with 'CoordSystem',1
          e.g.: InitFDTD(5e5,1e-6,'OverSampling',10, 'CoordSystem',1)

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
 function FDTD = InitCylindricalFDTD(NrTS, endCrit, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
InitFDTD


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1341
 function FDTD = InitFDTD(varargin)

 Initialize the FDTD data-structure.

 optional field arguments for usage with openEMS:
   NrTS:           max. number of timesteps to simulate (e.g. default=1e9)
   EndCriteria:    end criteria, e.g. 1e-5, simulations stops if energy has
                   decayed by this value (<1e-4 is recommended, default=1e-5)
   MaxTime:        max. real time in seconds to simulate
   OverSampling:   nyquist oversampling of time domain dumps
   CoordSystem:    choose coordinate system (0 Cartesian, 1 Cylindrical)
   MultiGrid:      define a cylindrical sub-grid radius
   TimeStep:       force to use a given timestep (dangerous!)
   TimeStepFactor: reduce the timestep by a given factor (>0 to <=1)
   TimeStepMethod: 1 or 3 chose timestep method (1=CFL, 3=Rennigs (default))
   CellConstantMaterial: set to 1 to assume a material is constant inside
                         a cell (material probing in cell center)

 examples:
   %default init with 1e9 max. timesteps and -50dB end-criteria
   FDTD = InitFDTD();

   %init with 1e6 max. timesteps and -60dB end-criteria
   FDTD = InitFDTD('NrTS', 1e6, 'EndCriteria', 1e-6);

   %cylindrical FDTD simulation
   FDTD = InitFDTD('CoordSystem', 1);

   See also InitCSX

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig (c) 2010-2013



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 35
 function FDTD = InitFDTD(varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
InitQueue


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1628
 function [queue] = InitQueue(varargin)

 Use this function to initialize a queue to run one or more matlab scripts
 in parallel.
 This can be used to efficiently run an openEMS parameter sweep in parallel
 on multiple remote machines.

 Options:
   DependPath: Add multiple paths, your script may depend on
   UseOctave:  Enable/Disable octave usage
   MaxThreads: max. number of parallel executions

 Note:
   - Currently only Linux/Unix is supported
   - By default Octave is used to spawn parallel functions (saves
       licenses), but this can be changed by:
       [queue] = InitQueue('UseOctave', 0);
       You may need to change this, if your script is not octave compatible
   - To efficiently run openEMS in parallel, you need to run it on several
   machines using a SSH.host_list setting --> See also RunOpenEMS

 Example:
   %serial version:
   for n=1:10
       % manipulate parameter etc.
       [result1(n) result2(n)] = Parallel_Func_Name(param1, param2);
   end

   %parallel version:
   queue = InitQueue('DependPath',{'/opt/openEMS/CSXCAD/matlab', ...
                                   '/opt/openEMS/openEMS/matlab'});
   for n=1:10
       % manipulate parameter etc.
       queue = Add2Queue(queue, 'Parallel_Func_Name', {param1, param2});
   end

   % wait for all to finish
   [queue] = FinishQueue(queue);

   % retrieve result
   for n=1:numel(stub_sweep)
     [result1(n) result2(n)] = ResultsQueue(queue,n);
   end

 See also: Add2Queue, FinishQueue, ResultsQueue, RunOpenEMS,
           RunOpenEMS_Parallel, FindFreeSSH

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
 function [queue] = InitQueue(varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
PlotHDF5FieldData


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 279
 function PlotHDF5FieldData(file, PlotArgs)

 e.g.
 PlotArgs.slice = {0 [10 20] 0};
 PlotArgs.pauseTime=0.01;
 PlotArgs.component=2;
 PlotArgs.Limit = 'auto';
 
 PlotHDF5FieldData('tmp/Et.h5',PlotArgs)

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
 function PlotHDF5FieldData(file, PlotArgs)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ReadHDF5Attribute


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 232
 attr = ReadHDF5Attribute(file, groupname, attr_name)

 internal function for openEMS to read hdf5 attributes

 See also: ReadHDF5ComplexData

 openEMS Matlab/Octave interface
 -----------------------
 author: Thorsten Liebig, 2012



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
 attr = ReadHDF5Attribute(file, groupname, attr_name)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
ReadHDF5Dump


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 922
[field mesh] = ReadHDF5Dump(file, varargin)

   Read a hdf5 field dump, including an interpolation and frequency domain
   transformation.

   For more information about the output, refer to the help of
   ReadHDF5Mesh and ReadHDF5FieldData

   possible arguments:
       'Range'             see GetField_Range
       'Interpolation'     see GetField_Interpolation
       'SubSampling'       see GetField_SubSampling
       'Frequency'         see GetField_TD2FD
       'CloseAlpha': 0 (default) / 1

   example:
   [field mesh] = ReadHDF5Dump('Et.h5');
   or
   [field mesh] = ReadHDF5Dump('Et.h5','Range',{[0 100],[-20 20],[50 90]});
   or
   [field mesh] = ReadHDF5Dump('Et.h5','Interpolation',[21 1 101],'Frequency',300e6);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Mesh ReadHDF5FieldData GetField_Interpolation GetField_SubSampling
 GetField_TD2FD GetField_Range



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
[field mesh] = ReadHDF5Dump(file, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 17
ReadHDF5FieldData


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 681
 function hdf_fielddata = ReadHDF5FieldData(file)

 returns:
 % time domain data (if exist)
 hdf_fielddata.TD.time
 hdf_fielddata.TD.names
 hdf_fielddata.TD.values
 hdf_fielddata.TD.DataType (0 --> real value data)

 % frequency domain data (if exist)
 hdf_fielddata.FD.frequency
 hdf_fielddata.FD.values
 hdf_fielddata.FD.DataType (0 / 1 --> real / complex value data)

 example: values of timestep 12:
 hdf_fielddata.TD.values{12}: array (x,y,z,polarization)

 plot z-field component along y-direction for timestep 12:
 plot( hdf_fielddata.TD.values{12}(1,:,1,3) )

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5Mesh ReadHDF5Dump



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
 function hdf_fielddata = ReadHDF5FieldData(file)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
ReadHDF5Mesh


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 366
 function hdf_mesh = ReadHDF5Mesh(file)

   Get the raw mesh data stored in the hdf5 dump file created by openEMS

 returns:
 hdf_mesh.type     (0-> Cartesian, 1-> cylindrical mesh type)
 hdf_mesh.names    (e.g. 'Mesh/y')
 hdf_mesh.lines    (e.g. [0,1,2,3,4])

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also ReadHDF5FieldData



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 39
 function hdf_mesh = ReadHDF5Mesh(file)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
ReadUI


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 944
 function UI = ReadUI(files, path, freq, varargin)

 read current and voltages from multiple files found in path

 returns voltages/currents in time and frequency-domain

 remarks on the frequency-domain:
 - all signals are assumed to start at t=0
 - currents that e.g. start at t = +delta_t/2 will be phase shifted by
    exp(-j*w*t(1))

 optional parameter:
 freq: frequency-domain values will be calculated according to 'freq'
       if 'freq' is not given, a (zero padded) FFT will be used

 optional key,value pairs:
 'AR'  : auto-regressive model to improve FD accuracy
         values: order to use within an AR model or 'auto'

 % examples:
 U = ReadUI({'ut1_1','ut1_2'},'tmp' );
 I = ReadUI('it1'            ,'tmp',[0.5e9 1e9 1.5e9]);
 
 % using the auto-regressive model
 U = ReadUI('port_ut1' , 'tmp', 'AR', 'auto');
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig

 See also DFT_time2freq, AR_estimate



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
 function UI = ReadUI(files, path, freq, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
ResultsQueue


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 283
 function [varargout] = ResultsQueue(queue, n)

 Use this function to retrieve the results from a finished queue.

 For more details see: InitQueue

 See also: InitQueue, FinishQueue, Add2Queue, RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
 function [varargout] = ResultsQueue(queue, n)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
RunOpenEMS


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 2927
 function RunOpenEMS(Sim_Path, Sim_File, <opts, Settings>)

 Run an openEMS simulation.

 arguments:
 Sim_Path: specify the simulation folder (folder must exist!)
 Sim_File: xml-filename to simulate, created by WriteOpenEMS

 optional arguments
 
 opts:  list of openEMS options
        possible options:
         --disable-dumps      Disable all field dumps for faster simulation
         --debug-material     Dump material distribution to a vtk file for debugging
         --debug-PEC          Dump metal distribution to a vtk file for debugging
         --debug-operator     Dump operator to vtk file for debugging
         --debug-boxes        Dump e.g. probe boxes to vtk file for debugging
         --debug-CSX          Write CSX geometry file to debugCSX.xml
         --engine=<type>      Choose engine type
             --engine=fastest         fastest available engine (default)
             --engine=basic           basic FDTD engine
             --engine=sse             engine using sse vector extensions
             --engine=sse-compressed  engine using compressed operator + sse vector extensions
             --engine=MPI             engine using compressed operator + sse vector extensions + MPI parallel processing
             --engine=multithreaded   engine using compressed operator + sse vector extensions + MPI + multithreading
         --numThreads=<n>     Force use n threads for multithreaded engine
         --no-simulation      only run preprocessing; do not simulate
         --dump-statistics    dump simulation statistics to 'openEMS_run_stats.txt' and 'openEMS_stats.txt'

          Additional global arguments
         --showProbeDiscretization    Show probe discretization information
         --nativeFieldDumps           Dump all fields using the native field components
         -v,-vv,-vvv                  Set debug level: 1 to 3


 settings: list of Matlab settings
       possible settings:
           Settings.LogFile = 'openEMS.log'
           Settings.Silent  = 0

       additional remote simulation settings
       Note: ssh only on unix with working ssh client or windows with putty client
           openEMS Linux server or Windows with cygwin necessary
       Settings.SSH.host = '<hostname or ip>'
       Settings.SSH.bin = '<path_to_openEMS>/openEMS.sh'
       ssh optional:
       Settings.SSH.host_list = {'list','of','hosts'}; %searches for a free host
       %on Windows needed additionally
       Settings.SSH.Putty.Path = '<path_to>\putty';
       Settings.SSH.Putty.Key = '<path_to>\putty_private_key.ppk';

       MPI settings:
       Settings.MPI.xxx --> help RunOpenEMS_MPI
 

 example:
 %create CSX and FDTD
 WriteOpenEMS('/tmp/path_to_run_in/myfile.xml', FDTD, CSX)
 RunOpenEMS('/tmp/path_to_run_in','myfile.xml','-v')

 See also WriteOpenEMS FindFreeSSH InitCSX InitFDTD RunOpenEMS_MPI

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 58
 function RunOpenEMS(Sim_Path, Sim_File, <opts, Settings>)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
RunOpenEMS_MPI


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 513
 function RunOpenEMS_MPI(Sim_Path, Sim_File, NrProc,  opts, Settings)

 Run an openEMS simulation with MPI support

 % mpi binary path on all nodes needed
 Settings.MPI.Binary = '/opt/openEMS/openEMS';
 % number of processes to run
 Settings.MPI.NrProc = 3;
 % define the mpi hosts :
 Settings.MPI.Hosts = {'host1','host2','host3'};

 RunOpenEMS(Sim_Path, Sim_File, NrProc, opts, Settings)

 See also SetupMPI, WriteOpenEMS, RunOpenEMS

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 69
 function RunOpenEMS_MPI(Sim_Path, Sim_File, NrProc,  opts, Settings)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 19
RunOpenEMS_Parallel


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 953
 function [stdout, stderr] = RunOpenEMS_Parallel(Sim_Paths, Sim_Files, opts, Settings, varargin)
 
 Run multiple openEMS simulations in parallel, distributed on multiple 
 machines using a ssh host_list! (currently on Linux only)
 
 This function relies on InitQueue etc.
 
 input:
       Sim_Paths:  cell array of paths to simulate by RunOpenEMS
       Sim_Files:  filename or cell array of filenames to simulate
       opts:       openEMS options. see also RunOpenEMS
       Settings:   use the settings to define multiple host for simulation
                   e.g.: Settings.SSH.bin ='<path_to_openEMS>/openEMS.sh';
                         Settings.SSH.host_list = {'list','of','hosts'};
 
 Note: If no SSH host_list is defined, this function will skip the
       parallel run and switch back to a default RunOpenEMS!
 
 See also RunOpenEMS, FindFreeSSH, InitQueue
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig 2011



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 function [stdout, stderr] = RunOpenEMS_Parallel(Sim_Paths, Sim_Files, opts, ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
SetBoundaryCond


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1227
 FDTD = SetBoundaryCond(FDTD, BC, varargin)

 BC = [xmin xmax ymin ymax zmin zmax];
 or BC = {xmin xmax ymin ymax zmin zmax};
 ?min/?max: 
   0 = PEC      or  'PEC'
   1 = PMC      or  'PMC'
   2 = MUR-ABC  or  'MUR'
   3 = PML-ABC  or  'PML_x' with pml size x => 4..50
 
 example:
 BC = [ 1     1     0     0     2     3     ]  %using numbers or
 BC = {'PMC' 'PMC' 'PEC' 'PEC' 'MUR' 'PML_8'}  %using equivalent strings

 mur-abc definitions
 define a phase-velocity to be used by the mur-abc
 useful e.g. for dispersive waveguides
 FDTD = SetBoundaryCond(FDTD,BC,'MUR_PhaseVelocity',299792457.93272);
 
 
 pml definitions
 	arguments:  'PML_Grading','gradFunction'
 		Define the pml grading grading function.
 		Predefined variables in this grading function are:
 			D  = depth in the pml in meter
 			dl = mesh delta inside the pml in meter
 			W  = width (length) of the pml in meter
 			N  = number of cells for the pml
 			Z  = wave impedance at the current depth and position
 
 example: 
 FDTD = SetBoundaryCond(FDTD,BC); 
 or
 FDTD = SetBoundaryCond(FDTD,BC,'PML_Grading','-log(1e-6)*log(2.5)/(2*dl*pow(2.5,W/dl)-1) * pow(2.5, D/dl) / Z');

 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
 FDTD = SetBoundaryCond(FDTD, BC, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 15
SetCustomExcite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 401
 function FDTD = SetCustomExcite(FDTD,f0,funcStr)

 f0 : nyquist rate
 funcStr : string describing the excitation function e(t)

 see also SetSinusExcite SetGaussExcite

 e.g for a ramped sinus excite...
 T = 1/f0;
 FDTD = SetCustomExcite(FDTD,1e9,..
 [ '(1-exp(-1*(t/' num2str(T) ')^2) ) * sin(2*pi*' num2str(f0) '*t)' ]);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 49
 function FDTD = SetCustomExcite(FDTD,f0,funcStr)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
SetDiracExcite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
undocumented function: FDTD = SetDiracExcite (FDTD)


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 51
undocumented function: FDTD = SetDiracExcite (FDTD)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
SetGaussExcite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 281
 function FDTD = SetGaussExcite(FDTD,f0,fc);

 f0 : center frequency
 fc : 20dB cutoff frequency --> bandwidth is 2*fc

 see also SetSinusExcite SetCustomExcite

 e.g FDTD = SetGaussExcite(FDTD,1e9,1e8);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 44
 function FDTD = SetGaussExcite(FDTD,f0,fc);



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
SetSinusExcite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 199
 function FDTD = SetSinusExcite(FDTD,f0)

 see also SetGaussExcite SetCustomExcite

 e.g FDTD = SetSinusExcite(FDTD,1e9);

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 40
 function FDTD = SetSinusExcite(FDTD,f0)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
SetStepExcite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
undocumented function: FDTD = SetStepExcite (FDTD)


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
undocumented function: FDTD = SetStepExcite (FDTD)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
SetupMPI


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 405
 function FDTD = SetupMPI(FDTD, varargin);

 % example, split the FDTD mesh in 2 equal parts in x-direction
 % and split the FDTD mesh in 3 parts in z-direction, split at z=-500 and z=500
 % this will need a Settings.MPI.NrProc of 2*3=6
 FDTD = SetupMPI(FDTD,'SplitN_X',2 ,'SplitPos_Z', '-500,500');
 
 See also RunOpenEMS_MPI
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 42
 function FDTD = SetupMPI(FDTD, varargin);



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
WriteHDF5


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 330
 function WriteHDF5(filename,hdf_fielddata,hdf_mesh)

 input:
   hdf_fielddata.time
   hdf_fielddata.names
   hdf_fielddata.values
   hdf_mesh.type
   hdf_mesh.names
   hdf_mesh.lines

 openEMS matlab interface
 -----------------------
 (C) 2010 Sebastian Held <sebastian.held@uni-due.de>
 See also ReadHDF5FieldData ReadHDF5Mesh



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
 function WriteHDF5(filename,hdf_fielddata,hdf_mesh)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
WriteOpenEMS


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 292
 function WriteOpenEMS(filename, FDTD, CSX)

 Write the FDTD and CSX structures to a file.

 example:
 CSX = InitCSX();
 FDTD = InitFDTD();
 WriteOpenEMS('test.xml',FDTD,CSX)

 See also InitFDTD InitCSX CSXGeomPlot

 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
 function WriteOpenEMS(filename, FDTD, CSX)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 14
calcLumpedPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1288
 [port] = calcLumpedPort( port, SimDir, f, varargin)

 Calculate voltages and currents of given lumped port.

 The port has to be created by e.g. AddLumpedPort().

 input:
   port:       return value of e.g. AddMSLPort()
   SimDir:     directory, where the simulation files are
   f:          frequency vector for DFT

 variable input:
   'RefImpedance':  - use a given reference impedance to calculate inc and
                      ref voltages and currents
                    - default is given port or calculated line impedance
   'SwitchDirection': 0/1, switch assumed direction of propagation

 output:
   % output signals/values in time domain (TD):
   port.ut.tot     total voltage (time-domain)
   port.ut.time    voltage time vector
   port.it.tot     total current (time-domain)
   port.it.time    current time vector

   % output signals/values in frequency domain (FD):
   port.f                  the given frequency factor
   port.uf.tot/inc/ref     total, incoming and reflected voltage
   port.if.tot/inc/ref     total, incoming and reflected current

 example:
   port{1} = calcLumpedPort( port{1}, Sim_Path, f, 'RefImpedance', 50);

 openEMS matlab interface
 -----------------------
 (C) 2012 Thorsten Liebig <thorsten.liebig@gmx.de>

 See also AddLumpedPort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
 [port] = calcLumpedPort( port, SimDir, f, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
calcPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1975
 [port] = calcPort( port, SimDir, f, varargin)

 Calculate:
   - voltages and currents
   - the propagation constant and the characteristic impedance (if applicable)

 The port has to be created by e.g. AddMSLPort(), AddLumpedPort() or AddCurvePort

 input:
   port:       return value of AddMSLPort()
   SimDir:     directory, where the simulation files are
   f:          frequency vector for DFT
 
 variable input:
   'RefImpedance':  - use a given reference impedance to calculate inc and
                      ref voltages and currents
                    - default is given port or calculated line impedance
   'RefPlaneShift': for transmission lines only, See also calcTLPort for
                    more details
   'SwitchDirection': 0/1, switch assumed direction of propagation
   'SignalType':    'pulse' (default) or 'periodic'

 output: 
   % output signals/values in time domain (TD):
   port.ut.tot     total voltage (time-domain)
   port.ut.time    voltage time vector
   port.it.tot     total current (time-domain)
   port.it.time    current time vector

   % output signals/values in frequency domain (FD):
   port.f                  the given frequency fector
   port.uf.tot/inc/ref     total, incoming and reflected voltage
   port.if.tot/inc/ref     total, incoming and reflected current
   port.ZL_ref             used reference impedance

   port.P_inc              incoming power
   port.P_ref              reflected power
   port.P_acc              accepted power (incoming minus reflected,
                           may be negative for passive ports)

   if port is a transmission line port:
   port.beta:              propagation constant
   port.ZL:                characteristic line impedance

 example:
   port = calcPort(port, Sim_Path, f, 'RefImpedance', 50);

 openEMS matlab interface
 -----------------------
 (C) 2012 Thorsten Liebig <thorsten.liebig@gmx.de>

 See also AddMSLPort, AddLumpedPort, AddCurvePort, calcTLPort, calcLumpedPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
 [port] = calcPort( port, SimDir, f, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
calcTLPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1959
 [port] = calcTLPort( port, SimDir, f, varargin)

 Calculate voltages and currents, the propagation constant beta
 and the characteristic impedance ZL of the given transmission line port.

 The port has to be created by e.g. AddMSLPort().

 input:
   port:       return value of e.g. AddMSLPort()
   SimDir:     directory, where the simulation files are
   f:          frequency vector for DFT

 variable input:
   'RefImpedance':  - use a given reference impedance to calculate inc and
                      ref voltages and currents
                    - default is given port or calculated line impedance
   'RefPlaneShift': - use a given reference plane shift from port beginning
                      for a desired phase correction
                    - default is the measurement plane
                    - the plane shift has to be given in drawing units!
   'SwitchDirection': 0/1, switch assumed direction of propagation

 output:
   % output signals/values in time domain (TD):
   port.ut.tot     total voltage (time-domain)
   port.ut.time    voltage time vector
   port.it.tot     total current (time-domain)
   port.it.time    current time vector

   % output signals/values in frequency domain (FD):
   port.f                  the given frequency fector
   port.uf.tot/inc/ref     total, incoming and reflected voltage
   port.if.tot/inc/ref     total, incoming and reflected current
   port.beta:              propagation constant
   port.ZL:                characteristic line impedance
   port.ZL_ref             used reference impedance

 example:
   port{1} = calcTLPort( port{1}, Sim_Path, f, 'RefImpedance', 50);

 reference: W. K. Gwarek, "A Differential Method of Reflection Coefficient Extraction From FDTD Simulations",
            IEEE Microwave and Guided Wave Letters, Vol. 6, No. 5, May 1996

 openEMS matlab interface
 -----------------------
 (C) 2010 Sebastian Held <sebastian.held@uni-due.de>

 See also AddMSLPort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 [port] = calcTLPort( port, SimDir, f, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
calcWGPort


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1879
 [port] = calcWGPort( port, SimDir, f, varargin)

 Calculate voltages and currents, the propagation constant beta
 and the characteristic impedance ZL of the given waveguide port.

 The port has to be created by e.g. AddWaveGuidePort().

 input:
   port:       return value of e.g. AddWaveGuidePort()
   SimDir:     directory, where the simulation files are
   f:          frequency vector for DFT

 variable input:
   'RefImpedance':  - use a given reference impedance to calculate inc and
                      ref voltages and currents
                    - default is given port or calculated line impedance
   'RefPlaneShift': - use a given reference plane shift from port beginning
                      for a desired phase correction
                    - default is the measurement plane at the end of the
                      port
                    - the plane shift has to be given in drawing units!
   'RefractiveIndex': set a material refractive index
   'SwitchDirection': 0/1, switch assumed direction of propagation

 output:
   % output signals/values in time domain (TD):
   port.ut.tot     total voltage (time-domain)
   port.ut.time    voltage time vector
   port.it.tot     total current (time-domain)
   port.it.time    current time vector

   % output signals/values in frequency domain (FD):
   port.f                  the given frequency fector
   port.uf.tot/inc/ref     total, incoming and reflected voltage
   port.if.tot/inc/ref     total, incoming and reflected current
   port.beta:              propagation constant
   port.ZL:                characteristic line impedance
   port.ZL_ref             used reference impedance

 example:
   port{1} = calcWGPort( port{1}, Sim_Path, f, 'RefImpedance', 50);

 openEMS matlab interface
 -----------------------
 (C) 2013 Thorsten Liebig (thorsten.liebig@gmx.de)

 See also AddWaveGuidePort, calcPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
 [port] = calcWGPort( port, SimDir, f, varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 9
calc_ypar


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 554
 Y = calc_ypar( f, ports, Sim_Path_Prefix )

 f: frequency vector (Hz)
 ports: cell array of ports (see AddMSLPort() and AddLumpedPort())
 Sim_Path_Prefix: prefix of the simulation dirs (will be postfixed by
 excitation port number)

 This function calculates the Y-matrix representation of the ports

 It is assumed that each port (inside ports) is excited and the
 corresponding simulation was carried out at Sim_Path + portnr (e.g. for
 port 2: '/tmp/sim2')

 Sebastian Held <sebastian.held@uni-due.de>
 Jun 9 2010

 See also AddMSLPort AddLumpedPort



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 43
 Y = calc_ypar( f, ports, Sim_Path_Prefix )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
harminv


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 447
 [f,decay,Q,amp,phase,err]=harminv( timeseries, timestep, start_freq, stop_freq )

 reconstruct time signal with:
 real(amp(n) * exp(-1i*(2*pi*freq(n)*t-phase(n))-decay(n)*t)));

 example:
 t = linspace(0,(1/0.3e9)*5,1000);
 u =     0.8 * sin(2*pi*0.7e9 * t + 0/180*pi);
 u = u + 0.3 * sin(2*pi*0.3e9 * t + 0/180*pi);
 [freq,decay,Q,amp,phase,err]=harminv( u, t(2)-t(1), 0, 1e9 );

 -----------------------
 Sebastian Held <sebastian.held@gmx.de>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
 [f,decay,Q,amp,phase,err]=harminv( timeseries, timestep, start_freq, stop_fr...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
optimize


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1121
params = optimize( optimdir, params, options, algorithm )

 input:
   optimdir:   folder where to optimize
   params:     array of structures with parameters to optimize
     .name       char string   parameter name (e.g. 'length1')
     .value      number  
     .step       number        discretization of .value
     .range      row vector    range of .value (e.g. [1 10])
     .active     (0/1)         1=optimize this parameter
   options:    structure
     .folder_matlabstart   set the startup folder for matlab or octave
     .simfun               char string with the simulation function name
     .octave_exe           if this field is present, octave is used
     .clean                clean the optimization folder before optimization start
   algorithm:  'asco' or 'simplex-downhill'
   
 output:
   params: optimal values
   result: optimization criterion for optimal values

 example:
   see openEMS/matlab/examples/optimizer

 notes:
   Create a file named 'STOP_OPTIMIZATION' in the optimdir folder to stop
   the optimization process (or press Ctrl+C).

 (C) 2010 Sebastian Held <sebastian.held@gmx.de>



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 57
params = optimize( optimdir, params, options, algorithm )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
optimizer_asco_sim


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 375
optimizer_asco_sim( optimdir, inputfile, outputfile, simfun )

 This function is called from general.sh. Do not call it yourself.

 tasks:
  - set correct matlab path
  - evaluate input file
  - start simulation or get result from cache
  - post-process simulation results
  - create output file (important: needs single \n at the first line and double \n at the last line!)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 61
optimizer_asco_sim( optimdir, inputfile, outputfile, simfun )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
physical_constants


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 22

 physical constants




# name: <cell-element>
# type: sq_string
# elements: 1
# length: 20

 physical constants



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
plotFF3D


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 769
  h = plotFF3D(nf2ff,varargin)

  plot normalized 3D far field pattern

 input:
   nf2ff:      output of CalcNF2FF

 variable input:
   'freq_index':  - use the given frequency index, see nf2ff.freq
                  - default is 1
   'logscale':    - if set, show far field with logarithmic scale
                  - set the dB value for point of origin
                  - values below will be clamped
   'normalize':   - true/false, normalize linear plot
                  - default is false, log-plot is always normalized!

   example:
       plotFF3D(nf2ff, 'freq_index', 2, 'logscale', -20)

       see examples/antennas/infDipol.m

 See also CalcNF2FF, plotFFdB, polarFF
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig, Stefan Mahr



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
  h = plotFF3D(nf2ff,varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
plotFFdB


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 716
  h = plotFFdB(nf2ff,varargin)

  plot far field pattern in dBi

 input:
   nf2ff:      output of CalcNF2FF

 variable input:
   'freq_index':  - use the given frequency index, see nf2ff.freq
                  - default is 1
   'xaxis':       - 'phi' (default) or 'theta'
   'param':       - array positions of parametric plot
                  - if xaxis='phi', theta is parameter, and vice versa
                  - default is 1

   example:
       plotFFdB(nf2ff, 'freq_index', 2, ...
                       'xaxis', 'phi', 'param', [1 46 91])

       see examples/NF2FF/infDipol.m

 See also CalcNF2FF, plotFF3D, polarFF
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig, Stefan Mahr



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 30
  h = plotFFdB(nf2ff,varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
plotRefl


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1122
  h = plotRefl(port,varargin)

  plot the reflection coefficient of a port into a Smith chart.
  left and right facing triangles mark the lower and upper cutoff
  frequency of the pass bands. An asterisk marks the frequnecy with 
  the lowest reflection.

 input:
   port:      port data structure. Call calcPort with an appropriate 
              frequency vector before calling this routine
 
 output:      graphics handle for further modification of the plot.

 variable input:
   'precision':   - number of decimal places (floating point precision) 
                    for the frequency (always in MHz), default is 0
   'threshold':   - Threshold value (in dB) for the upper and lower
                    cutoff frequency, default is -3
   'fmarkers':    - set lower and upper frequency marker in Hz manually, 
                    like so: [4e9, 6.5e9]
   example:
       myport = calcPort(myport, Sim_Path, linspace(f_0-f_c, f_0+f_c, 200));
       plotRefl(myport, 'fmarkers', [4e9, 6.5e9]);

 See also calcPort
 
 openEMS matlab interface
 -----------------------
 author: Georg Michel



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
  h = plotRefl(port,varargin)

  plot the reflection coefficient of a port ...



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 7
polarFF


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1371
  h = polarFF(nf2ff,varargin)

  plot polar far field pattern

 input:
   nf2ff:      output of CalcNF2FF

 variable input:
   'freq_index':  - use the given frequency index, see nf2ff.freq
                  - default is 1
   'xaxis':       - 'phi' (default) or 'theta'
   'param':       - array positions of parametric plot
                  - if xaxis='phi', theta is parameter, and vice versa
                  - default is 1
   'normalize':   - true/false, normalize linear plot
                  - default is false, log-plot is always normalized!
   'logscale':    - if set, plot logarithmic polar
                  - set the dB value for point of origin if scalar
                  - set point of origin and maximum if 2-element array
                  - values below minimum will be clamped
                  - default is -20
   'xtics':       - set the number of tics for polar grid
                  - default is 5

   example:
       polarFF(nf2ff, 'freq_index', 2, ...
                      'xaxis', 'phi', 'param', [1 46 91] );

       polarFF(..., 'normalize', true );
       polarFF(..., 'logscale', -30 );
       polarFF(..., 'logscale', [-30 10]);

       polarFF(..., 'xtics', 10);

       see examples/antenna/infDipol.m

 See also CalcNF2FF, plotFFdB, plotFF3D
 
 openEMS matlab interface
 -----------------------
 author: Thorsten Liebig, Stefan Mahr



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
  h = polarFF(nf2ff,varargin)



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
queue_addProcess


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 103
 [pid,filenames] = queue_addProcess( command )

 Sebastian Held <sebastian.held@uni-due.de>
 12.5.2010



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 46
 [pid,filenames] = queue_addProcess( command )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 18
queue_checkProcess


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 107
 [alive,stdout,stderr] = queue_checkProcess( pid )

 Sebastian Held <sebastian.held@uni-due.de>
 12.5.2010



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 50
 [alive,stdout,stderr] = queue_checkProcess( pid )



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
queue_delProcess


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 167
 [stdout,stderr] = queue_delProcess( pid, filenames )

 if pid == 0, do not kill a process, but clean up files

 Sebastian Held <sebastian.held@uni-due.de>
 12.5.2010



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
 [stdout,stderr] = queue_delProcess( pid, filenames )





