# Nyquist plot maker and EIS equivalent-circuit fitting

> Paste frequency, Z′ and Z″ or drop an EC-Lab or Gamry file: Nyquist and Bode plots, equivalent-circuit fit with ± SE and χ². Free, in your browser.

URL: https://www.labcanvas.com/tools/nyquist-plot-eis-fitting

Paste your impedance spectrum (frequency, Z′ and Z″, or an EC-Lab, Gamry, CH Instruments or Autolab export) and you get a Nyquist plot with equal axes and a Bode plot, an equivalent circuit fitted by complex nonlinear least squares (Randles, CPE, Warburg, two-arc, coating and Gerischer circuits, or your own in impedance.py notation), every parameter with its standard error, χ² and reduced χ², and a Kramers–Kronig check of the data. The fit minimises Σ[(Z′ − Z′fit)² + (Z″ − Z″fit)²]/|Z|² over all frequencies.

## Quick answer

- **What it does:** Draws the Nyquist and Bode plots of an impedance spectrum and fits an equivalent circuit to it by complex nonlinear least squares, with standard errors, χ², derived capacitances and a Lin-KK validity test.
- **Formula:** χ² = Σ [(Z′ᵢ − Z′fit)² + (Z″ᵢ − Z″fit)²] / |Zᵢ|²; Randles cell Z = R0 + 1/(jωC + 1/(R1 + σ(1 − j)/√ω)); CPE Z = 1/(Q(jω)ⁿ)
- **Example:** The built-in Randles-cell spectrum (61 frequencies, 100 kHz to 0.1 Hz, simulated with Rs 15 Ω, Rct 120 Ω, Cdl 20 µF, σ 45 Ω·s^−½) fitted with R0-p(R1-W1,C1) gives R0 = 14.99 ± 0.013 Ω, R1 = 119.8 ± 0.14 Ω, σ = 45.18 ± 0.22 Ω·s^−½ and C1 = 20.05 ± 0.03 µF, reduced χ² 1.7 × 10⁻⁵.

Free, in the browser, no account needed. Updated 2026-11-17.

## Features

- Paste frequency, Z′ and Z″ (or −Z″, or |Z| and phase) from Excel, or drop an EC-Lab .mpt, Gamry .DTA, CH Instruments or Autolab text export; units (kΩ, Ω·cm², kHz) are read from the column names
- Nyquist plot with equal axis scales and frequencies marked, and a Bode plot (|Z| and phase against log frequency), both with the fitted curve
- Circuits: Randles, Randles with CPE, R–RC, R–(R‖CPE), two time constants, coating model, finite-length diffusion (Wo), Gerischer, or any circuit you type in impedance.py notation
- Automatic circuit choice from the shape of the spectrum (arcs and a diffusion tail), and an optional AICc comparison of the common circuits
- Every parameter with its standard error and relative SE, χ², reduced χ², mean and largest residual; effective capacitance of each CPE (Hsu–Mansfeld) and time constants
- Lin-KK Kramers–Kronig test (Schönleber et al. 2014) to check that the spectrum is valid before you trust the fit
- Modulus, proportional or unit weighting; area-normalised values from the electrode area
- Copy the parameter table (pastes into Excel) and a methods sentence; PNG of the Nyquist and Bode plots; CSV; nothing is uploaded

## How to use it

1. **Paste or drop your spectrum**: Three columns: frequency (Hz), Z′ and Z″ (either sign; −Z″ is recognised), with or without a header row. Or drop the file your potentiostat exported: EC-Lab .mpt, Gamry .DTA, CH Instruments or Autolab text.
2. **Pick a circuit or let it choose**: Leave “Automatic” to start from the shape of the spectrum, choose a common circuit, or type your own such as R0-p(R1,CPE1)-W1. Tick “Compare common circuits” to rank them by AICc.
3. **Read the fit**: Check the Nyquist plot and the residuals, read each parameter ± SE, and look at the Kramers–Kronig verdict. A relative SE above about 50 % means the data do not determine that element: simplify the circuit.
4. **Take it further**: Copy the parameters or the methods sentence, download the plots, or open your data in the LabCanvas Graph app with the same fit.

## At a glance

| | |
| --- | --- |
| Input | Frequency, Z′ and Z″ (or \|Z\| and phase); EC-Lab .mpt, Gamry .DTA, CH Instruments, Autolab text, CSV |
| Plots | Nyquist (equal axes, frequencies marked) and Bode, with the fitted curve |
| Fit | Complex nonlinear least squares (Levenberg–Marquardt), modulus, proportional or unit weighting |
| Output | Parameters ± SE, χ², χ²/ν, residuals, effective capacitances, time constants, AICc comparison |
| Validity | Lin-KK Kramers–Kronig test (Schönleber et al. 2014) |
| Engine | The LabCanvas Graph app’s EIS analysis, checked against impedance.py |

## How it works

$$\chi^2 = \sum_{i=1}^{N} \frac{(Z'_i - Z'_\mathrm{fit}(\omega_i))^2 + (Z''_i - Z''_\mathrm{fit}(\omega_i))^2}{|Z_i|^2}$$

$$\chi^2_\nu = \chi^2 / (2N - p)$$

$$C_\mathrm{eff} = Q^{1/n} R^{(1-n)/n}$$

**Complex nonlinear least squares.** The real and imaginary parts are fitted together (Boukamp 1986), so a circuit has to reproduce the arc and the phase at the same time. With modulus weighting each residual is divided by |Z|, so a point at 10 Ω counts as much as one at 10 kΩ; this is the usual choice when the measurement errors are not known (impedance.py's `weight_by_modulus`). The minimiser is Levenberg–Marquardt started from estimates read off the spectrum (high-frequency intercept, arc diameter, peak frequency) and from several rescaled starting points, so it is less likely to stop in a local minimum. Standard errors come from the covariance matrix scaled by \(\chi^2_\nu\), with \(2N\) residuals for \(N\) frequencies and \(p\) parameters.

**Circuit notation.** Elements in series are joined with “-”, elements in parallel go in `p( , )`, and every element is numbered: `R0-p(R1-W1,C1)` is the Randles cell. The elements and their impedances are those of impedance.py (Murbach et al. 2020): R, C, L; CPE \(Z = 1/(Q(j\omega)^n)\); semi-infinite Warburg W \(Z = \sigma(1 - j)/\sqrt{\omega}\); finite-space Wo \(Z_0\coth\sqrt{j\omega\tau}/\sqrt{j\omega\tau}\); finite-length Ws \(Z_0\tanh\sqrt{j\omega\tau}/\sqrt{j\omega\tau}\); Gerischer G. A CPE in parallel with a resistor is converted to an effective capacitance with the Hsu–Mansfeld formula above.

**Is the spectrum valid?** A circuit fit assumes the system was linear, causal and stable while you measured. The Lin-KK test (Schönleber et al. 2014) fits a chain of RC elements that obeys the Kramers–Kronig relations by construction; residuals within about 1 % of |Z| on average (none above 3 %) say the data are consistent, and a trend at low frequency usually means drift.

**Same numbers as the Graph app.** The page runs the LabCanvas Graph app's own EIS analysis, which is checked against impedance.py's `circuit_fit` and Lin-KK on simulated spectra; the hand-off opens the same table and fit there.

Sources: Boukamp BA. *Solid State Ionics* 1986;20:31–44, [doi:10.1016/0167-2738(86)90031-7](https://doi.org/10.1016/0167-2738(86)90031-7). Murbach MD et al. impedance.py. *J Open Source Softw* 2020;5:2349, [doi:10.21105/joss.02349](https://doi.org/10.21105/joss.02349). Schönleber M, Klotz D, Ivers-Tiffée E. *Electrochim Acta* 2014;131:20–27, [doi:10.1016/j.electacta.2014.01.034](https://doi.org/10.1016/j.electacta.2014.01.034). Hsu CH, Mansfeld F. *Corrosion* 2001;57:747–748, [doi:10.5006/1.3280607](https://doi.org/10.5006/1.3280607).

## Worked example: fitting a Randles cell

The built-in example is a simulated spectrum, not a measurement: a Randles cell with solution resistance 15 Ω, charge-transfer resistance 120 Ω, double-layer capacitance 20 µF and Warburg coefficient 45 Ω·s −½, at 61 frequencies from 100 kHz to 0.1 Hz with 0.4 % noise, in EC-Lab's column names (freq/Hz, Re(Z)/Ohm, −Im(Z)/Ohm).

- **Read the plot.** The Nyquist plot starts at Z′ ≈ 15 Ω (the high-frequency intercept, the solution resistance), draws one semicircle about 120 Ω wide with its top near 66 Hz, and turns into a 45° line below 1 Hz: charge transfer, then diffusion.
- **Automatic circuit.** From that shape the tool picks R0-p(R1-W1,CPE1) and fits CPE1 n = 0.9999, an ideal capacitor, with the note that a C element would do. Ticking “Compare common circuits” ranks the Randles cell R0-p(R1-W1,C1) first by AICc (Akaike weight 72 %).
- **Randles fit.** With R0-p(R1-W1,C1): R0 = **14.99 ± 0.013 Ω**, R1 = **119.8 ± 0.14 Ω**, W1 σ = **45.18 ± 0.22 Ω·s −½**, C1 = **20.05 ± 0.03 µF**, reduced χ² = 1.7 × 10⁻⁵, mean residual 0.32 % of |Z|: the values the spectrum was made with.
- **Validity.** The Lin-KK test passes (mean residual 0.71 %, largest 2.4 %), so the spectrum can be fitted.
- **Time constant.** R1·C1 = 119.8 Ω × 20.05 µF = 2.40 ms, so the arc peaks at 1/(2π × 2.40 ms) ≈ 66 Hz, where the plot has its top.

| Circuit | Notation | Use for |
| --- | --- | --- |
| Randles cell | R0-p(R1-W1,C1) | One arc and a 45° diffusion tail (ferri/ferrocyanide, corrosion with diffusion) |
| R–(R‖CPE) | R0-p(R1,CPE1) | One depressed semicircle |
| Two time constants | R0-p(R1,CPE1)-p(R2,CPE2) | Two arcs: SEI film and charge transfer, grain and grain boundary |
| Battery electrode | R0-p(R1,CPE1)-Wo1 | Charge transfer, then finite (solid-state) diffusion that turns capacitive |
| Coating model | R0-p(CPE1,R1-p(CPE2,R2)) | Coated metal: coating capacitance and pore resistance, then corrosion at the metal |



## Questions

### How do I make a Nyquist plot?

Plot −Z″ (the negative imaginary part) on the y axis against Z′ on the x axis, one point per frequency, with the same scale on both axes so semicircles look round. Paste frequency, Z′ and Z″ into this page and it draws the Nyquist plot with frequencies marked, plus the Bode plot.

### How do I fit an equivalent circuit to EIS data?

Choose a circuit that matches the shape of the spectrum (one arc: R–(R‖CPE); arc plus 45° tail: Randles; two arcs: two RC or R‖CPE elements in series), fit Z′ and Z″ together by complex nonlinear least squares with modulus weighting, and check that every parameter has a small relative standard error and that the residuals have no trend.

### What do χ² and reduced χ² tell me?

χ² is the weighted sum of squared residuals; reduced χ² divides it by the degrees of freedom (2N − p). With modulus weighting a reduced χ² near 10⁻⁴ to 10⁻⁵ means the fit is within about 1 % of |Z|. Compare circuits by AICc rather than χ² alone, because extra elements always lower χ².

### When should I use a CPE instead of a capacitor?

When the arc is a depressed semicircle (its centre below the real axis), from surface roughness, porosity or a distribution of time constants. n = 1 is an ideal capacitor; n near 0.5 behaves like diffusion. Report the effective capacitance from the Hsu–Mansfeld formula, not Q itself.

### Which sign of Z″ should I paste?

Either. Capacitive arcs have negative Z″; many programs export −Z″ (positive). A column named with a minus sign (−Im(Z), -Z″) is read as −Z″, and a Z″ column whose values are mostly positive is also read as −Z″.

### Is this like ZView, EC-Lab Z Fit or impedance.py?

It does the same kind of complex nonlinear least-squares fit with the same element definitions as impedance.py, and is checked against it. It runs in your browser with no install and no account; for many spectra, batch fits and figures, use the LabCanvas Graph app.
