next up previous contents
Next: B.2 The Special-Purpose Stepping Up: B. The Stepping Module Previous: B. The Stepping Module

B.1 The Basic Stepping Functions

For simple additive or multiplicative (logarithmic) stepping the normal step function can be used. Here, start is the start value of the parameter, stop its final value, and delta the additive or multiplicative increment. The first three arguments must be of the same type or must be convertible to the same type. The type of the return value is determined by this conversion operation.

a = step(0,   2  , 1    );   // returns an integer
b = step(0,   2  , 1.0  );   // returns a real
c = step(0 V, 2 V, 1.0 V);   // returns a quantity with unit V
d = step(0 V, 2  , 1.0  );   // returns a quantity with unit V

In the case of quantity arguments the first three arguments must be of convertible units. For missing units the default unit (of the first parameter) is used, but it is recommended to provide units to all parameters. Basically, the resulting unit is always the equivalent SI-unit.

a = step(0 W, 2 "J/s", 1 eV);     // quite a long loop, but OK
                                  // returns "W" as unit
b = step(0 V, 2 A, 1.0);          // mismatching units, error

The optional parameter log determines whether additive or multiplicative stepping is used with additive being the default.

Ni = step(10e3, 1e20, 1.2, log = yes);

The stepN function is similar to the step function, the only difference being the third argument. Here, it specifies the number of step points to be used.

Ni = stepN(10e3, 1e20, 100, log = yes); // use 100 points

The number of steps is used to calculate a stepping delta. Consequently, the stepN function is treated like a step function. This is particularly important as both functions can be attached to stepping control algorithm to modify the stepping delta during the simulation (see Appendix B.4).


next up previous contents
Next: B.2 The Special-Purpose Stepping Up: B. The Stepping Module Previous: B. The Stepping Module

S. Wagner: Small-Signal Device and Circuit Simulation