**Installing the D-SR Toolbox for MATLAB**

- Make a folder with the name, d-sr
- Use Winzip and extract the contents of the zip file d-sr.zip (or d-sr.rar) to this folder.
- Set path within matlab to the d-sr folder

**Simple use of DSR**

A discrete time linearized state space model can simply be computed in the MATLAB command window as follows:

[A,B,C,D,CF,F,x0]=dsr(Y,U,L)

- Y is an output data matrix with dimension (N x m) where N is the number of observations and m is the number of output variables.
- U is an input data matrix with dimension (N x r) where r is the number of input variables.
- L is a positive integer parameter, e.g.,. L=5. the user can then identify a state space model with order bounded by, 1 <= n <= Lm

The Kalman filter gain matrix is then, K=CF*inv(F) when F is nonsingular.

As a ruke of thumb chose the prediction horizon L as low as possible.

**Closed loop identification**

For noisy systems with feedback in the data one may use the, DSR_e, function in the D-SR Toolbox which may be executed in MATLAB as:

[A,B,C,D,K,F,x0] = dsr_e(Y,U,L,g,J,n)

where, g, is a structure parameter. g=0 if the feedthrough matrix D=0 and g=1 if D is to be estimated. Put g=0 for closed loop data/systems.

Integer parameter L is as above and J >1 and "large".

"With DSR the model is served and ready to use.."