## 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 fixed sources, it defines voltage or current as a function of
time.

The meaning of the `x` and `y` values depends on the component type:

component |
X |
Y |

C (capacitor) |
voltage |
charge |

E (VCVS) |
voltage |
voltage |

F (CCCS) |
current |
current |

G (VCCS) |
voltage |
current |

H (CCVS) |
current |
voltage |

I (current source) |
time |
current |

L (inductor) |
current |
flux |

R (resistor) |
current |
voltage |

V (voltage source) |
time |
voltage |

Y (admittance) |
voltage |
current |

VCCAP |
voltage |
capacitance |

VCG |
voltage |
conductance |

VCR |
voltage |
resistance |

trans-capacitor |
voltage |
charge |

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.