function y=mnorm(cov, x) 
% multivariate normal density function
% example: mnorm([1, 0.1; 0.1, 1], [0.1, 0.2])

    s=size(x);
    y=1;
    
    % run through rows, i.e. tics
    for n=1:s(1)
        % current tic
        x1=x(n,1:end);

        % compute normal density
        %f(x) = {1 / [(2?)n/2 (det V)1/2]} exp[?(x ? ?)' V?1 (x ? ?) / 2)
        % http://www.math.uah.edu/statold/special/special8.html
        y1= x1*inv(cov)*(x1');
        y2= exp(-y1/2);
        y3= y2/ sqrt((2*pi)^s(2) *det(cov));
    
        % assume all days to be independent
        y=y*y3;
    end
    