density

Density of truncated normal distribution

Information

This information is part of the Modelica Standard Library maintained by the Modelica Association.

Syntax

Normal.density(u, u_min=0, u_max=1, mu=0, sigma=1);

Description

This function computes the probability density function according to a truncated normal distribution with minimum value u_min, maximum value u_max, mean value of original distribution mu and standard deviation of original distribution sigma (variance = sigma2). Plot of the function:

For more details
of the normal distribution, see Wikipedia,
of truncated distributions, see Wikipedia.

Example

  density(0.5)                // = 1.041828977196953
  density(0.5,-1.5,1.5,1,0.9) // = 0.5365495585520803

See also

TruncatedNormal.cumulative, TruncatedNormal.quantile.

Syntax

y = density(u, u_min, u_max, mu, sigma)

Inputs (5)

u

Type: Real

Description: Random number over the real axis (-inf < u < inf)

u_min

Default Value: 0

Type: Real

Description: Lower limit of u

u_max

Default Value: 1

Type: Real

Description: Upper limit of u

mu

Default Value: (u_max + u_min) / 2

Type: Real

Description: Expectation (mean) value of the normal distribution

sigma

Default Value: (u_max - u_min) / 6

Type: Real

Description: Standard deviation of the normal distribution

Outputs (1)

y

Type: Real

Description: Density of u