# Electromagnetics

Solve problems that model electric and magnetic fields

Solve PDEs that model static and time-harmonic electric and magnetic fields. A typical programmatic workflow for solving an electromagnetic problem includes these steps:

• Create a special electromagnetic model container for an electrostatic, magnetostatic, or harmonic analysis.

• Define a geometry and mesh it.

• Assign electromagnetic properties of the material, such as relative permittivity, relative permeability, and conductivity.

• Specify charge density, current density, and magnetization within the geometry.

• Specify voltage, magnetic potential, surface current density, and an electric or magnetic field on the boundaries.

• Specify absorbing boundary conditions.

• Solve and plot results, such as the resulting electric or magnetic potentials, fields, and flux densities.

## Functions

expand all

 `createpde` Create model `electromagneticProperties` Assign properties of material for electromagnetic model (Since R2021a) `electromagneticSource` Specify current density, charge density, and magnetization for electromagnetic model (Since R2021a) `electromagneticBC` Apply boundary conditions to electromagnetic model (Since R2021a) `solve` Solve structural analysis, heat transfer, or electromagnetic analysis problem `assembleFEMatrices` Assemble finite element matrices
 `interpolateElectricPotential` Interpolate electric potential in electrostatic or DC conduction result at arbitrary spatial locations (Since R2021a) `interpolateElectricField` Interpolate electric field in electrostatic or DC conduction result at arbitrary spatial locations (Since R2021a) `interpolateElectricFlux` Interpolate electric flux density in electrostatic result at arbitrary spatial locations (Since R2021a) `interpolateMagneticPotential` Interpolate magnetic potential in magnetostatic result at arbitrary spatial locations (Since R2021a) `interpolateMagneticField` Interpolate magnetic field in magnetostatic result at arbitrary spatial locations (Since R2021a) `interpolateMagneticFlux` Interpolate magnetic flux density in magnetostatic result at arbitrary spatial locations (Since R2021a) `interpolateHarmonicField` Interpolate electric or magnetic field in harmonic result at arbitrary spatial locations (Since R2022a) `interpolateCurrentDensity` Interpolate current density in DC conduction result at arbitrary spatial locations (Since R2022b)
 `pdeplot` Plot solution or mesh for 2-D problem `pdeplot3D` Plot solution or surface mesh for 3-D problem `pdegplot` Plot PDE geometry `pdemesh` Plot PDE mesh `pdeviz` Create and plot PDE visualization object (Since R2021a)
 `findElectromagneticProperties` Find electromagnetic material properties assigned to geometric region (Since R2021a) `findElectromagneticSource` Find electromagnetic source assigned to geometric region (Since R2021a) `findElectromagneticBC` Find electromagnetic boundary conditions assigned to geometric region (Since R2021a)

 Visualize PDE Results Create and explore visualizations of PDE results in the Live Editor (Since R2022b)

## Objects

 `ElectromagneticModel` Electromagnetic model object (Since R2021a) `ElectrostaticResults` Electrostatic solution and derived quantities (Since R2021a) `MagnetostaticResults` Magnetostatic solution and derived quantities (Since R2021a) `HarmonicResults` Harmonic electromagnetic solution (Since R2022a) `ConductionResults` DC conduction solution (Since R2022b)

## Properties

 ElectromagneticMaterialAssignment Properties Electromagnetic material properties assignments (Since R2021a) ElectromagneticSourceAssignment Properties Electromagnetic source assignments (Since R2021a) ElectromagneticBCAssignment Properties Electromagnetic boundary condition assignments (Since R2021a) PDESolverOptions Properties Algorithm options for solvers PDEVisualization Properties PDE visualization of mesh and nodal results (Since R2021a)