Main Content

generateSPICE

Generate SPICE file from rationalfit of S-parameters

Description

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.

example

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

generateSPICE(___,SeparateReferenceNodes=tf) allows the choice of whether the reference nodes for each port are called out in the SPICE subcircuit, specified as either true or false. (since R2024b)

Examples

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);
generateSPICE(fit,'passive.ckt')

The circuit is saved in your current folder.

Input Arguments

collapse all

Rational fit 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

Since R2024b

Options to call out the reference node, specified as either true or false. When SeparateReferenceNodes is set to false, no reference nodes are called out and the reference is assumed to be node 0.

Version History

Introduced in R2019b

expand all