function x = gennormal(mu, P)
%% generate a random vector x from a normal distribution with
%% mean mu and covariance P

    x = sqrtm(P)*randn(size(mu)) + mu;
