Data generation - datagen.m


 N Scalar integer Number of samples
 nl Scalar integer Number of latent variables
 nx Scalar integer Number of observable variables
 t Column vector Time
 x Matrix Observable variables in the columns
 latgen Matrix Latent variables in the column
This function generates data that have been used for illustration. The latent variables are depicted in Figure 1.

By default there is a change in the relationship between the latent variables at the quarter and a change in the mean at the half.

Note: if you want to use more than 4 latent variables, you will have to expand the variable called swt, which contains the sample time interval of the latent variables (i.e. the difference between two changes).

N=2000;  % Number of samples
nl=2;    % Number of latent variables
nx=6;    % Number of observable variables