Contenu principal

simulateMagnitudeAndPhase

R2026b

Simulate circuit in frequency domain and obtain magnitude and phase data

Since R2026b

Description

[magnitude,phase,frequency] = simulateMagnitudeAndPhase(eisfom,frequency) simulates the fractional-order equivalent circuit model, eisfom, in the frequency domain and returns the magnitude, phase, and corresponding frequency points.

example

[magnitude,phase,frequency,figureHandle] = simulateMagnitudeAndPhase(eisfom,frequency,Plot="on") also plots the magnitude and phase of the circuit impedance and returns the handle to the plot. This plot is the Bode representation of the circuit impedance.

example

Examples

collapse all

This example shows how to simulate two different electrochemical impedance spectroscopy (EIS) models in the frequency domain and plot the magnitude and phase of the impedances by using the simulateMagnitudeAndPhase function.

Create a fractional-order equivalent circuit model with a resistor in series with a parallel configuration of a second resistor and a capacitor.

eisfom = eisModel("R0+(R1,C1)")
eisfom = 
  EISModel with properties:

     CircuitTopology: "R0+(R1,C1)"
       NumParameters: 3
       ParameterList: ["R0"    "R1"    "C1"]
     ParameterValues: [0.0250 0.0035 150]
    CircuitImpedance: "(R0 + ((R1 * (1/(i*w*C1))) / (R1 + (1/(i*w*C1)))))"
       ParameterList: ["R0"    "R1"    "C1"]

Define the frequency points you want to simulate the model at.

freq = logspace(-2,5,100)

Simulate the EIS circuit at these frequencies and plot the magnitude and phase of the impedance.

[magnitude,phase,frequency,handle] = simulateMagnitudeAndPhase(eisfom,freq,Plot="on");

Plot of magnitude and phase for the R0+(R1,C1) circuit

Now add a Warburg impedance term to the EIS circuit topology and observe how the magnitude and phase change.

eisfom.CircuitTopology = "R0 + (R1,C1) + SIW1";
eisfom = 

  EISModel with properties:

     CircuitTopology: "R0 + (R1,C1) + SIW1"
       NumParameters: 4
       ParameterList: ["R0"    "R1"    "C1"    "SIW1"]
     ParameterValues: [0.0250 0.0035 150 1.0000e-03]
    CircuitImpedance: "((R0 + ((R1 * (1/(i*w*C1))) / (R1 + (1/(i*w*C1))))) + (SIW1*(w)^(-1/2) - SIW1*i*(w)^(-1/2)))"
       ParameterList: ["R0"    "R1"    "C1"    "SIW1"]

Simulate the circuit and plot the magnitude and phase. Starting in R2026b, you can plot the magnitude and phase directly by using the Plot name-value argument of the simulateMagnitudeAndPhase function.

[simRealZ,simImagZ,handle] = simulateMagnitudeAndPhase(eisfom,freq,Plot="on");

Plot of magnitude and phase for the R0+(R1,C1) + SIW1 circuit

Input Arguments

collapse all

Fractional-order equivalent circuit model to simulate in the frequency domain, specified as an EISModel object.

Frequency at which to simulate the circuit, specified as a scalar or vector.

Data Types: double

Option to plot the magnitude and phase of the circuit impedance, specified as "on" or "off", or as numeric or logical 1 (true) or 0 (false). A value of "on" is equivalent to true, and "off" is equivalent to false. Thus, you can use the value of this property as a logical value.

Output Arguments

collapse all

Magnitude of the circuit impedance, returned as a scalar or a vector.

Data Types: double

Phase of the circuit impedance, returned as a scalar or a vector.

Data Types: double

Frequency points at which the function evaluates the impedance magnitude and phase, returned as a scalar or vector.

Data Types: double

Handle to the figure that contains the plot of the magnitude and phase of the circuit impedance, returned as a Figure object.

Version History

Introduced in R2026b