## 4.10 `PWL`: Piecewise linear function

### 4.10.1 Syntax

`PWL` x1,y1 x2,y2 ...

### 4.10.2 Purpose

Defines a piecewise linear transfer function or time dependent value.

### 4.10.3 Comments

This is similar to, but not exactly the same as, the Berkeley SPICE PWL for fixed sources.
For capacitors, this function defines charge as a function of voltage. For inductors, it defines flux as a function of current.
For fixed sources, it defines voltage or current as a function of time.
The values of x must be in increasing order.
Outside the specified range, the behavior depends on the type of element. For fixed sources, the output (voltage or current) is constant at the end value. This is compatible with SPICE. For other types, the last segment is extended linearly. If you want it to flatten, specify an extra point so the slope of the last segment is flat.

### 4.10.4 Parameters

There are no additional parameters, beyond those that apply to all.

### 4.10.5 Example

`C1 2 0 pwl -5,-5u 0,0 1,1u 4,2u 5,2u`
  This “capacitor” stores 5 microcoulombs at -5 volts (negative, corresponding to the negative voltage, as expected. The charge varies linearly to 0 at 0 volts, acting like a 1 microfarad capacitor. (C = dq/dv). This continues to 1 volt. The 0,0 point could have been left out. The charge increases only to 2 microcoulombs at 4 volts, for an incremental capacitance of 1u/3 or .3333 microfarads. The same charge at 5 volts indicates that it saturates at 2 microcoulombs. For negative voltages, the slope continues.