Stochastic systems additions#714
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
This PR adds new functionality and doesn't change any old functionality, so going ahead and merging (since it has been sitting for a while). |
|
Sorry to jump in a little late here... Doesn't Also, since this is generating multivariate noise, why not allow Q to be a covariance matrix with correlations between variables? This can be done by eg: |
|
The current code handles the multi-variate case, though in the case of a diagonal In terms of the scaling: we are essentially approximating the continuous white noise process by a piecewise constant (discrete) noise process. You have to scale the discrete-time signal by You can find an example of using these functions (and some insight into the scaling) here: https://github.com/python-control/python-control/blob/main/examples/stochresp.ipynb (Google Colab version). |
|
OK, I see. You mean that you're scaling it such that after you integrate the output of (I also overlooked the last line of your function!). Never mind my comment then! |
This PR adds new functionality for supporting analysis and simulation of stochastic systems, based on a class that I taught at Caltech:
Adds two new functions supporting random signals:
white_noise, which creates a white noise vector in continuous or discrete time, andcorrelation, which calculates the correlation function (or [cross-] correlation matrix), R(tau).Adds a new function
create_estimator_iosystemthat matches the style ofcreate_statefbk_iosystem(I/O system enhancements #710) and creates an I/O system implementing an estimator (including covariance update).Adds the ability to specify initial conditions for
input_output_responseas a list of values, so that for estimators that keep track of covariance you can set the initial conditions as[X0, P0]. In addition, if you specify a fewer number of initial conditions than the number of states, the remaining states will be initialized to zero (with a warning if the last initial condition is not zero). This allows the initial conditions to be given as[X0, 0].Adds the ability to specify inputs for
input_output_responseas a list of variables. Each element in the list will be treated as a portion of the input and broadcast (if necessary) to match the time vector. This allows input for a system with noise as[U, V]and inputs for a system with zero noise as[U, np.zero(n)](where U is an input signal andnp.zero(n)gets broadcast to match the time vector).Added some new Jupyter notebooks demonstrate the use of these functions:
stochresp.ipynb: illustrates the implementation of random processes and stochastic response.pvtol-outputfbk.ipynb: illustrates the implementation of an extended Kalman filter and the use of the estimated state for LQR feedback of a vectored thrust aircraft model.kincar-fusion.ipynb: works through estimation of the state of a car changing lanes with two different sensors available: one with good longitudinal accuracy and the other with good lateral accuracy.