# normstat

Normal mean and variance

## Syntax

``[m,v] = normstat(mu,sigma)``

## Description

example

````[m,v] = normstat(mu,sigma)` returns the mean and variance of the normal distribution with mean `mu` and standard deviation `sigma`.The mean of the normal distribution with parameters µ and σ is µ, and the variance is σ2.```

## Examples

collapse all

Compute the mean and variance of the normal distribution with parameters `mu` and `sigma`.

```mu = 1; sigma = 1:5; [m,v] = normstat(mu,sigma)```
```m = 1×5 1 1 1 1 1 ```
```v = 1×5 1 4 9 16 25 ```

## Input Arguments

collapse all

Mean of the normal distribution, specified as a scalar value or an array of scalar values.

To compute the means and variances of multiple distributions, specify distribution parameters using an array of scalar values. If both `mu` and `sigma` are arrays, then the array sizes must be the same. If either `mu` or `sigma` is a scalar, then `normstat` expands the scalar argument into a constant array of the same size as the other argument. Each element in `m` and `v` is the mean and variance of the distribution specified by the corresponding elements in `mu` and `sigma`.

Example: `[0 1 2; 0 1 2]`

Data Types: `single` | `double`

Standard deviation of the normal distribution, specified as a positive scalar value or an array of positive scalar values.

To compute the means and variances of multiple distributions, specify distribution parameters using an array of scalar values. If both `mu` and `sigma` are arrays, then the array sizes must be the same. If either `mu` or `sigma` is a scalar, then `normstat` expands the scalar argument into a constant array of the same size as the other argument. Each element in `m` and `v` is the mean and variance of the distribution specified by the corresponding elements in `mu` and `sigma`.

Example: `[1 1 1; 2 2 2]`

Data Types: `single` | `double`

## Output Arguments

collapse all

Mean of the normal distribution, returned as a scalar value or an array of scalar values. `m` is the same size as `mu` and `sigma` after any necessary scalar expansion. Each element in `m` is the mean of the normal distribution specified by the corresponding elements in `mu` and `sigma`.

Variance of the normal distribution, returned as a scalar value or an array of scalar values. `v` is the same size as `mu` and `sigma` after any necessary scalar expansion. Each element in `v` is the variance of the normal distribution specified by the corresponding elements in `mu` and `sigma`.

## Alternative Functionality

 Evans, M., N. Hastings, and B. Peacock. Statistical Distributions. 2nd ed. Hoboken, NJ: John Wiley & Sons, Inc., 1993.