Forward problem functions - Data-Acquisition-and-Processing-Lab/ECTsim GitHub Wiki

addNoise

Adds noise to measurements based on the specified signal-to-noise ratio.

Usage: [model] = addNoise(model, SNRdb);

  • model - structure with a numerical model description.
  • SNRdb - Signal to Noise Ratio (SNR) of the measurement.

boundaryVoltageVector

Identifies points with boundary conditions, finds points with unknown potential, sets the voltage on electrodes and screens (Dirichlet), and generates a linear vector (1D) of voltage distribution for a given electrode number. The matrix B is constructed using the column vectors of boundary voltage.

Important: The voltage can be gradually reduced at the tips of the electrodes to avoid singular points at sharp edges using a smoothing coefficient.

Usage: [model] = boundaryVoltageVector(model, varargin);

  • model - structure with a numerical model description.
  • varargin (if used):
    • scoeff - optional value in the range (0, 0.5] which controls the smoothness.

calculateComponents

Calculates values of measurement components, used by the calculateMeasurement function.

Usage: [model] = calculateComponents(model);

  • model - structure with a numerical model description.
  • Calculated values include:
    • model.C - Capacitance.
    • model.G - Conductivity.
    • model.Y - Admittance.

calculateElectricField

Calculates electric field vectors at the points of a nonuniform mesh stored in the qt structure. Electric field components [Ex, Ey] are stored in two matrices: qt.Ex and qt.Ey, where the number of rows equals the number of leaves, and the number of columns equals the number of excitations. Varargin is used only by the calculatePotential function.

Usage: [model] = calculateElectricField(model, varargin);

  • model - structure with a numerical model description.
  • varargin (if used by calculatePotential):
    • mode - 'mldivide' (default) or 'bicgstab'; 'bicgstab' is iterative and suggested for 3D simulations with an excessive number of mesh elements.
    • tol - tolerance value for the 'bicgstab' algorithm, default is 1e-3.

calculateMeasurement

Calculates values of measurements.

Usage: [model] = calculateMeasurements(model);

  • model - structure with a numerical model description.
  • Calculated values:
    • model.K - Complex capacitance.
    • Uses calculateComponents to obtain:
      • model.C - Capacitance.
      • model.G - Conductivity.
      • model.Y - Admittance.

calculatePotential

Calculates electric field potential at the points of a nonuniform mesh stored in the qt structure. If a 3D simulation in Matlab results in an "out of memory" error, an iterative calculation can be used by setting the mode to 'bicgstab'.

Usage: [model] = calculatePotential(model, mode, tol);

  • model - structure with a numerical model description.
  • mode - 'mldivide' (default) or 'bicgstab'; 'bicgstab' is iterative and is suggested for 3D simulations with an excessive number of mesh elements.
  • tol - tolerance value for the 'bicgstab' algorithm, default is 1e-3.

calculateSensitivityMaps

Calculates sensitivity at the points of a nonuniform mesh stored in the qt structure using a scalar product with the conjugate. Sensitivity is stored in sparse vectors S(elem,pair), where the number of rows equals the number of leaves and the number of columns equals the number of electrode pairs. The calculated sensitivity depends on the size of the pixel and requires normalization before interpolation to a uniform mesh.

Usage: [model] = calculateSensitivityMaps(model);

  • model - structure with a numerical model description.

electrodePairs

Calculates two indices of electrode numbers for electrode pairs (application electrode, sensing electrode). The position in the vectors corresponds to the order of measurement of mutual capacitance of electrodes.

Usage: [application, receiving] = electrodePairs(elecNum, all);

  • elecNum - number of electrodes in the sensor.
  • all - 0 for without, 1 with repeating measurements (1-2 and 2-1).
  • application - vector with application electrode numbers.
  • receiving - vector with sensing electrode numbers.

findBoundaryCondInd

Finds mesh points where:

  • Boundary conditions are set (every point in the model that has a known value of electric potential).
  • Potential is switched (e.g., excitation electrodes).
  • Potential is unknown and should be calculated.

Usage: [bcInd, elInd, calcInd] = findBoundaryCondInd(model);

  • model - structure with a numerical model description.
  • Returns three sets of point indices.

findElement

Finds an element by name within a cell array and returns its index. If no element with the given name exists, the function returns 0.

Usage: [n] = findElement(name, cellArray);

  • name - The name of the element.
  • cellArray - Could be model.elements or model.sensor.
  • n - The index of the element.

findIndex

Finds indices in a mesh based on the element name.

Usage: index = findIndex(model, element_name);

  • model - Structure with a numerical model description.
  • element_name - The name of the element.

getConductivityMap

Creates a vector of conductivity values for the elements in the workspace.

Usage: [sigmaMap] = getConductivityMap(model);

  • model - Structure with a numerical model description.
  • sigmaMap - Map of conductivity values normalized by (2\pi f \epsilon_0).

getElementMap

Generates a pixel map of elements in the model, where pixel values correspond to the unique number of each element.

Usage: [epsilon_map, sigma_map] = getElementMap(model);

  • model - Structure with a numerical model description.
  • epsilon_map - 2D matrix containing epsilon values for the model.
  • sigma_map - 2D matrix containing sigma values for the model.

getPermittivityMap

Creates a vector of permittivity values for the elements in the workspace.

Usage: [epsMap] = getPermittivityMap(model);

  • model - Structure with a numerical model description.
  • epsMap - Map of relative permittivity values.

sensorElectrodePairs

Sets the number of electrode pairs and assigns excitation voltages to both excitation and receiving electrodes.

Usage: [model] = sensorElectrodePairs(model);

  • model - Structure with a model description. This function requires some sensor fields to be set before running: sensor.measurements_all.

setElectrodes

Identifies and enumerates electrodes based on their excitation potential within the model.

Usage: [model] = setElectrodes(model);

  • model - Structure with a numerical model description.