# control.util:linear_trend()


Calculate the linear trend of the data in the last 'interval' seconds.


Usage

``` python
control.util:linear_trend(
    timestamps,
    data,
    interval=60,
)
```


## Parameters


`timestamps: array - like`  
time stamps of data in Unix-time in seconds (e.g. from `time.time()`)

`data: array - like`  
past data points (most recent data point has index 0!). shape is assumed to be same for the two arguments

`interval: float = ``60`  
time interval of the data points which should be considered. Older data points are ignored.


## Note

Best use collections.deque and appendleft to generate the needed data


## Returns


`(slope, stdev)`  
slope and standard deviation of past `interval` seconds. If there are insufficient data points to calculate the statistics each value will be `None`.
