Data generation - datagen.m

Syntax:

[t,x,latgen]=datagen(N,nl,nx)

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).

Example:

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

[t,x,latgen]=datagen(N,nl,nx);