[37] | 1 | function p = normpdf(varargin)
|
---|
| 2 | %NORMPDF Multivariate normal probability density function.
|
---|
| 3 | % NORMPDF(x) returns a row vector giving the density at each column of x
|
---|
| 4 | % under a standard multivariate normal.
|
---|
| 5 | % NORMPDF(x,m) subtracts m from x first.
|
---|
| 6 | % If cols(m) == 1, subtracts m from each column of x.
|
---|
| 7 | % If cols(m) == cols(x), subtracts corresponding columns.
|
---|
| 8 | % If cols(x) == 1, x is repeated to match cols(m).
|
---|
| 9 | % NORMPDF(x,m,S) specifies the standard deviation, or more generally
|
---|
| 10 | % an upper triangular Cholesky factor of the covariance matrix.
|
---|
| 11 | % In the univariate case, multiple standard deviations can be specified.
|
---|
| 12 | % If m is empty, no subtraction is done (zero mean).
|
---|
| 13 | % NORMPDF(x,m,[],V) specifies the variance or covariance matrix.
|
---|
| 14 | % NORMPDF(x,m,'inv',iV) specifies the inverse of the covariance matrix, i.e.
|
---|
| 15 | % the precision matrix.
|
---|
| 16 | % NORMPDF(x,m,iS,'inv') specifies the reciprocal of the standard deviation,
|
---|
| 17 | % or more generally the upper triangular Cholesky factor of the
|
---|
| 18 | % inverse covariance matrix.
|
---|
| 19 | % This is the most efficient option.
|
---|
| 20 | % See test_normpdf for a timing test.
|
---|
| 21 |
|
---|
| 22 | % this may look strange, but computing normpdf directly is no faster or
|
---|
| 23 | % more stable than exp(normpdfln).
|
---|
| 24 | p = exp(normpdfln(varargin{:}));
|
---|