Main Content


Generate SPICE file from rationalfit of S-parameters

Since R2019b



generateSPICE(fit,filename) generates a SPICE file from a rationalfit of S-parameters. Simulation program with integrated circuit emphasis (SPICE) is a general-purpose, open-source analog electronic circuit simulator.

generateSPICE(fit,filename,zref) generates a SPICE file using the reference impedance specified by zref.


collapse all

Read a file named passive.s2p and fit the 2-by-2 S-parameters. Generate a SPICE file of these S-parameters.

S = sparameters('passive.s2p');
fit = rational(S);

The circuit is saved in your current folder.

Input Arguments

collapse all

Rationalfit of S-parameters, specified as an N-by-N array of rfmodel.rational objects as returned by the rationalfit function or a rational object with S-parameters as input.

Data Types: double

Name of file in which to store the SPICE subcircuit, specified as a string or a character vector. The SPICE subcircuit is constructed out of passive resistor (R) and capacitor (C) SPICE elements and controlled-source SPICE elements voltage-controlled voltage source (E), current-controlled current source (F), voltage-controlled current source (G), and current-controlled voltage source (H).

Data Types: char | string

Reference impedance, specified as a real scalar in ohms.

Data Types: double

Version History

Introduced in R2019b