# linear_ramp

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/linear_ramp

```python
boulderopal.signals.linear_ramp(duration, end_value, start_value=None, start_time=0.0, end_time=None)
```

Create a Signal object representing a linear ramp.

### Parameters
* **duration** (*float*) – The duration of the signal, $T$.
* **end_value** (*float* *or* *complex*) – The value of the ramp at $t = t_\mathrm{end}$, $a_\mathrm{end}$.
* **start_value** (*float* *or* *complex* *or* *None* *,* *optional*) – The value of the ramp at $t = t_\mathrm{start}$, $a_\mathrm{start}$.
  Defaults to $-a_\mathrm{end}$.
* **start_time** (*float* *,* *optional*) – The time at which the linear ramp starts, $t_\mathrm{start}$.
  Defaults to 0.
* **end_time** (*float* *or* *None* *,* *optional*) – The time at which the linear ramp ends, $t_\mathrm{end}$.
  Defaults to the given duration $T$.
### Returns
The linear ramp.
### Return type
[Signal](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/Signal.md#boulderopal.signals.Signal)

### SEE ALSO
[`Graph.signals.linear_ramp_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/linear_ramp_pwc.md#boulderopal.graph.signals.linear_ramp_pwc)
: Graph operation to create a Pwc representing a linear ramp.

[`Graph.signals.linear_ramp_stf`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/linear_ramp_stf.md#boulderopal.graph.signals.linear_ramp_stf)
: Graph operation to create a Stf representing a linear ramp.

[`boulderopal.signals.tanh_ramp`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/tanh_ramp.md#boulderopal.signals.tanh_ramp)
: Create a Signal object representing a hyperbolic tangent ramp.

## Notes

The linear ramp is defined as

$$
\mathop{\mathrm{Linear}}(t) =
\begin{cases}
    a_\mathrm{start} &\mathrm{if} \quad t < t_\mathrm{start}\\
    a_\mathrm{start} + (a_\mathrm{end} - a_\mathrm{start})
        \frac{t - t_\mathrm{start}}{t_\mathrm{end} - t_\mathrm{start}}
        &\mathrm{if} \quad t_\mathrm{start} \le t \le t_\mathrm{end} \\
    a_\mathrm{end} &\mathrm{if} \quad t > t_\mathrm{end}
\end{cases} .
$$

## Examples

Define a linear ramp with start and end times.

```pycon
>>> signal = bo.signals.linear_ramp(
...     duration=4, end_value=2, start_time=1, end_time=3
... )
>>> signal.export_with_time_step(time_step=0.25)
array([-2.  , -2.  , -2.  , -2.  , -1.75, -1.25, -0.75, -0.25,  0.25,
    0.75,  1.25,  1.75,  2.  ,  2.  ,  2.  ,  2.  ])
```
