Complex impedance is computed using time histories of voltage and charge therefore the following code must be included in the input file to enable impedance to be extracted in Review:

pout

histname electrode vq all /* Volt/charge time histories 1 & 2

end

Once the input file is run, it creates a history file which is read into Review using code such as the following:

text filename = InsertNameHere /* Change filename as required

read f1 '$filename.flxhst' /* Read time history

## Windowing/Padding

In some cases, the impedance plot is poorly discretized (or fractured). This is because the number of data points in the time history is insufficient to produce a suitably small frequency step size when the FFT was calculated.

The solution is to pad out the time history with extra zeros. Although this may sound like a cheat, it simply adds extra data points after the charge on the electrode in the model has already rung down to zero. This does not change the data; it merely extends the data set. The addition of the zero data points in the time set increases the number of points in the frequency set, thereby decreasing the frequency time step.

freq

file f2 /* Local file to store results

time pad 4 /* Zero padding for better resolution

end

Another common problem with impedance plots is the addition of ringing resonances in the operational impedance, when the simulation has not run for long enough and the charge has not dissipated from the electrode. This truncation of the charge signal introduces spurious signals into the impedance characteristics. Windowing the new local file prevents generation of these frequencies.

freq

file f2 /* Local file to store results

wndo hann righ 0.15 /* Windowing to ensure signals terminate at zero

end

## Calculation

The voltage and charge time history on an electrode where the drive function was applied are stored in records 2 and 3 which is what is used to calculate impedance.

freq

file f2 /* Local file to store results

type amp /* Results in Amplitude and Phase

impd f1 2 f1 3 /* Calculate Impedance Magnitude

end

By default, impedance data is output in magnitude and phase format; use of the **type** command can change this to real and imaginary. The **impd **command calculates the operational impedance based on arrays 2 and 3 in local file f1 and outputs the amplitude and phase to arrays 1 and 2, respectively, in local file f2.

## Plotting

Impedance curves can be plot using the **grph **command. The number of viewports is set using the **nvew** command and then **plot **is used to specify which curves to plot in the ports. Limits can be set on the X and Y axis using the **pset** command.

grph

type stnd /* Use standard graphics for Logarithmic plots

nvew 2

pset wndo 0 10.e6 /* Set up X Scale

plot f2 1 /* Plot Amplitude

set log y on

plot f2 2 /* Plot Phase

end

## 0 comments

Please sign in to leave a comment.