les);
    Y = repmat(reshape(Y,[1 1 numel(Y)]),[ntrials 1 1]);
    X = repmat(Y,[1 ncov 1]) + 0.5*randn(ntrials,ncov,nsamples); 
    
    k = dml.lds('inference','smooth','verbose',true,'indims',[ncov nsamples]);
    k = k.train(X,Y);
    Z = k.test(X);
    figure
    plot(squeeze(Y(1,:,:))','k');
    hold on;
    plot(squeeze(Z(1,:,:))','r');
    legend('real','predicted');
  
    k = dml.lds('verbose',true);
    k = k.train(X,nan(size(Y))); % hidden state estimation
    U = repmat(Y,[1 ncov 1]) + 0.1*rand