## Documentation Center |

On this page… |
---|

Probability Distributions in Test Vectors Create a Test Vector with Probability Distributions |

The SystemTest™ software provides an easy way to generate randomized test vector values for your test. You can use probability distribution functions to set up test vectors, which is useful for performing Monte Carlo analyses.

If you have the Statistics Toolbox™ software, the SystemTest software integrates with it to
provide use of some of its probability distribution functions, such
as exponential, gamma, lognormal, T (Student's t), and Weibull. If
you do not have the Statistics Toolbox software,
you can use the MATLAB^{®} probability
distribution functions normal (Gaussian) and uniform.

You can use a probability distribution when you create or edit a test vector. To use a probability distribution:

In the

**Test Vectors**pane, click the**New**button.In the Insert Test Vector dialog box, select

**Probability Distribution**as the test vector type.Enter a name for the new vector in the

**Name**field.Select a distribution function from the

**Distribution**list.If you have the Statistics Toolbox software, all of the functions shown in the figure appear in the list. If you do not have this toolbox, you can use normal (Gaussian) and uniform.

For information on the distribution functions, see The Probability Distributions.

Once you select a distribution, the relevant options appear. Fill in the parameters for your distribution.

For example, normal (Gaussian) allows you to set

**Mean**and**Standard deviation**.After setting the relevant probability parameters, type in the

**Number of values**you want to use. That is the number of values you would like to generate for the test vector.The

**Number of values**must be a positive integer. It must also be the same value for all of your probability distributions because the vector is grouped.If you want to see the data you have configured before running the test, click the

**View Data**button. This displays a histogram visualization of the probability distribution data. If you are not satisfied with the data as it is configured, you can adjust one or more of the parameters and hit**Enter**to see the changes in the figure window.For more information on viewing the data, see View Data While Configuring the Test Vector.

Select the

**Evaluate Test Vector each time the test is run**option if you want to use new values every time the test is run. For example, for the probability distribution, a new set of values for the parameters (such as Mean) would be calculated each time. Leave it unselected if you want to use the same values each time the test is run.If you are doing Monte Carlo testing and you want repeatability of the data, do not use this option.

On the

**Grouping**tab, keep the default of**Grouped**, or select**Ungrouped**.Randomized test vectors with probability distributions are grouped by default, as indicated by

**Grouped**being selected.Grouping test vectors is useful for reducing the number of iterations to execute. It means that the SystemTest software will sequentially combine values for all grouped test vectors, instead of permuting their values. In the case of randomized test vectors, grouping avoids introducing additional variation into your test. See Creating Grouped Test Vectors for more information on grouped test vectors.

Click

**OK**in the Insert Test Vector dialog box.The new vector then appears in the

**Test Vectors**pane.

You can view your probability distribution data while configuring the test vector, without having to run the test. You can quickly inspect the test vector data for outliers, data range coverage, or correctness of the test function before running the test. This allows you to make necessary adjustments until you have data you are satisfied with, which saves time.

To view data while configuring a test vector:

Create the test vector by clicking the

**New**button in the**Test Vectors**pane.In the Insert Test Vector dialog box, select

**Probability Distribution**as the test vector type.Select a distribution function from the

**Distribution**list.Once you select a distribution, the relevant parameters appear. Fill in the parameters for your distribution.

In this example, Normal (Gaussian) is shown, with a mean of 1.0, standard deviation of 3, and 40 values.

Click the

**View Data**button on the**General**tab.The data viewer window displays the data you configured in a histogram visualization. The values are displayed on the

*x-axis*, and in this case they range from approximately`-6`to`9`. The parameters are also displayed textually in the figure window in the upper right corner. For comparison purposes, a light orange line showing the "ideal" probability distribution is also displayed on top of your data.When satisfied with the data that is shown, click

**OK**to finish creating the test vector.If you are dissatisfied with the data, change one or more parameters and redisplay it. In this case, change the standard deviation from 3 to 2. To change a value, type a new value in the parameter you want to change and either press

**Enter**or click outside of the field. The figure window automatically updates to display the new data.

You can also view and modify the test vector data any time after
creating a test vector. Access the data viewer by clicking the **Test
Vectors** tab in the **Properties** pane,
then selecting a test vector from the list. That test vector then
becomes editable, and you can click the **View Data** button
on the **General** tab.

If you have the Statistics Toolbox software, the SystemTest software integrates with it to provide use of some of its probability distribution functions, such as exponential, gamma, lognormal, T (Student's t), and Weibull. If you do not have the Statistics Toolbox software, you have access to the MATLAB probability distribution functions normal (Gaussian) and uniform.

The SystemTest software
supports the distribution functions shown in the following sections.
Select the **Probability Distribution** test vector
type in the Insert Test Vector dialog box to access the functions.

The Insert Test Vectors dialog box shows fields specific to
the distribution you pick in the list, as shown in the sections below.
In each case, enter values for the function-specific parameters, and
then enter the **Number of values** you want to generate
for the test vector.

The normal distribution is a two-parameter family of curves. The first parameter is the mean. The second parameter is standard deviation. Normal is often used for data that is symmetrical about the mean.

Normal uses the function `randn` and takes
parameters for **Mean** and **Standard deviation**.
The SystemTest software uses
the following calculation for normal:

mean + Std_Dev * randn(1, #values)

For more information, see `randn` in the MATLAB documentation.

The uniform distribution (also called rectangular) has a constant probability density function between its two parameters, the minimum and the maximum.

The uniform distribution is appropriate for representing the distribution of round-off errors in values tabulated to a particular number of decimal places.

Uniform uses the function `rand` and takes
parameters for **Minimum value** and **Maximum
value**. The SystemTest software
uses the following calculation for uniform:

min + (max-min) * rand(1, #values)

For more information, see `rand` in the MATLAB documentation.

The exponential distribution is a special case of the gamma distribution. The exponential distribution is special because of its utility in modeling events that occur randomly over time.

Exponential is often used to model the time between independent events that happen at a constant average rate. For example, you could use it for the time it takes a radioactive particle decays, or the time between messages sent over a network.

Exponential uses the function `exprnd` and
takes one parameter for **Mean**.

For more information, see Exponential Distribution in the Statistics Toolbox™ documentation.

The gamma distribution models sums of exponentially distributed random variables.

Gamma uses the function `gamrnd` and takes
parameters for **A** and **B**.

For more information, see Gamma Distribution in the Statistics Toolbox documentation.

The normal and lognormal distributions are closely related. The lognormal distribution is applicable when the quantity of interest must be positive, since log(X) exists only when X is positive.

Lognormal can be used to model something that can be thought of as the multiplicative product of many small independent factors. A common example is the long-term return rate on a stock investment, because it can be considered as the product of daily return rates.

Lognormal uses the `lognrnd` function and takes
parameters for **Mean** and **Standard deviation**.

For more information, see Lognormal Distribution in the Statistics Toolbox documentation.

The T (Student's t) distribution is a family of curves that depend on a single parameter v (the degrees of freedom). As v goes to infinity, the T distribution approaches the standard normal distribution.

T is often used to estimate properties when the sample size is small.

T uses the `trnd` function and takes one parameter
for **Degrees of freedom**.

For more information, see Student's t Distribution in the Statistics Toolbox documentation.

The Weibull distribution is an appropriate analytical tool for modeling the breaking strength of materials. Current usage also includes reliability and lifetime modeling. The Weibull distribution is more flexible than the exponential distribution for these purposes.

Weibull uses the function `wblrnd` and takes
parameters for **A** and **B**.

For more information, see Weibull Distribution in the Statistics Toolbox documentation.

Many models must take into account the effect of evaluating uncertainty in model parameters. In this example the tester needs to account for uncertainty in electric motor characteristics that come off the production line so the tester defines the model's parameters as distributions of values, rather than as single fixed values. The tester then performs a Monte Carlo simulation, running the model repeatedly with random combinations of parameter values to account for variability in manufacturing.

In this case, the tester defines the uncertain motor parameters as test vectors. The test varies parameters for armature resistance, armature inductance, and shaft inertia.

To create the first vector, for armature resistance:

In the

**Test Vectors**pane, click the**New**button.In the Insert Test Vector dialog box, select

**Probability Distribution**as the test vector type.Enter

`ArmatureResistance`in the**Name**field.In the Insert Test Vector dialog box, use the default distribution, normal (Gaussian).

You do not need to have the Statistics Toolbox software installed to use normal (Gaussian) since it is included with MATLAB.

In the

**Mean**field, enter`1.71`.In the

**Standard deviation**field, enter`.056`.In the

**Number of values**field, enter`1000`.For this vector, the test is varying armature resistance up to a standard deviation of .056, around a mean of 1.71, and using 1000 values.

Click the

**View Data**button to see a visualization of the test vector data that you configured. This displays a histogram visualization of the probability distribution data that will be used when the test is run. If you are not satisfied with the data as it is configured, you can adjust one or more of the parameters and hit**Enter**to see the changes in the figure window. In this case, we keep the data, as shown here.For more information on viewing the data, see View Data While Configuring the Test Vector.

Click

**OK**in the Insert Test Vector dialog box.The new vector appears in the

**Test Vectors**pane.

To create the second vector, for armature inductance:

In the

**Test Vectors**pane, click the**New**button.In the Insert Test Vector dialog box, select

**Probability Distribution**as the test vector type.Enter

`ArmatureInductance`in the**Name**field.Use the default distribution, normal (Gaussian).

In the

**Mean**field, enter`.3`.In the

**Standard deviation**field, enter`.01`.In the

**Number of values**field, enter`1000`.For this vector, the test is varying armature inductance up to a standard deviation of .01, around a mean of .3, and using 1000 values.

You can optionally click the

**View Data**button to see a visualization of the test vector data that you configured.Click

**OK**in the Insert Test Vector dialog box.The new vector appears in the

**Test Vectors**pane.

To create the third vector, for shaft inertia:

In the

**Test Vectors**pane, click the**New**button.In the Insert Test Vector dialog box, select

**Probability Distribution**as the test vector type.Enter

`ShaftInertia`in the**Name**field.Use the default distribution, normal (Gaussian).

In the

**Mean**field, enter`44.5`.In the

**Standard deviation**field, enter`.443`.In the

**Number of values**field, enter`1000`.For this vector, the test is varying shaft inertia up to a standard deviation of .443, around a mean of 44.5, and using 1000 values.

You can optionally click the

**View Data**button to see a visualization of the test vector data that you configured.Click

**OK**in the Insert Test Vector dialog box.The new vector appears in the

**Test Vectors**pane.

Was this topic helpful?