Documentation

Contents

normstat

Normal mean and variance

Syntax

[M,V] = normstat(mu,sigma)

Description

[M,V] = normstat(mu,sigma) returns the mean of and variance for the normal distribution using the corresponding mean mu and standard deviation sigma. mu and sigma can be vectors, matrices, or multidimensional arrays that all have the same size, which is also the size of M and V. A scalar input for mu or sigma is expanded to a constant array with the same dimensions as the other input.

The mean of the normal distribution with parameters µ and σ is µ, and the variance is σ2.

Examples

n = 1:5;
[m,v] = normstat(n'*n,n'*n)
m =
   1   2   3   4   5
   2   4   6   8  10
   3   6   9  12  15
   4   8  12  16  20
   5  10  15  20  25

v =
   1   4   9  16  25
   4  16  36  64 100
   9  36  81 144 225
  16  64 144 256 400
  25 100 225 400 625
Was this topic helpful?