Spectrum Software
Industrial Strength Simulation




Spectrum Software has released Micro-Cap 11, the eleventh generation of our SPICE circuit simulator.

For users of previous Micro-Cap versions, check out the new features available in the latest version. For those of you who are new to Micro-Cap, take our features tour to see what Micro-Cap has to offer.




Using Array Variables


Array variables are real or complex symbolic variables accessed by an index variable which selects an element of the array. Here is the syntax for one dimensional arrays.

.ARRAY arrayname V1[,V2 [,V3...[,Vn]]...]

Note that there must be at least one element (V1) in the array and that a one-dimensional array of size N+1 has values located at 0, 1, 2, ...N.

You can define a one-dimensional array of real values like this:

.ARRAY CV 1n, 3n, 6n

To access the values you use an index variable that typically is created like this:


The index name may be any non-reserved name. You access the array contents like this:


For example, you could set the CAPACITANCE attribute of a capacitor to CV(M) and then the capacitor value takes on the CV array element that M is set to. If M is set with the .define statement to 1, then the capacitor value would be 3n.

If M is stepped through the values 0, 1, and 2, the capacitor value would take on the values 1n, 3n, and 6n respectively.

To illustrate how array variables can be used, we'll use this example.

Array circuit

Here we have a circuit that uses several array variables to capture the beta values for two different transistors. The devices that use model N1 specify the forward beta as


The devices that use model N2 specify the forward beta as


So if M takes on the values 0, 1, and 2, the BF values will take on these values.

M N1 N2

0 300 60

1 250 70

2 200 90

In this way you can use the M variable to select unique sets of BF values for the two types of bipolar transistors. These sets may represent worst case, or merely interesting, combinations of parameters.

Typically the index variable is stepped so that one run can show the effects of the BF combinations.

Here is the Stepping dialog box for transient analysis. Its settings step M from 0 through 4 accessing all of the defined array values.

Array circuit stepping dialog box

Here is the transient run.

Transient analyis of array circuit

You can label the branches using the Scope Menu / Label Branches option. The Automatic option usually works well but you can override it and specify where to place the labels by picking the X-axis location where there is a nice separation between the curves.

Here is the run with the branches labelled. Note that you must select the Label Branches option for each plot group in turn.

Transient analyis of array circuit

Here is the AC analysis run using the same Stepping dialog box settings as used in transient analysis.

AC analyis of array circuit

And here is the DC analysis run, again using the same Stepping dialog box settings as used in transient analysis.

DC analyis of array circuit

Array variables are powerful devices to specify complex simulation and stepping settings.

Download Summer 2012 Circuit Files
Return to the main Newsletter page