# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Visualize Central Limit Theorem in Array Plot

### Display a Uniform Distribution

This example shows how to use and configure the `dsp.ArrayPlot` to visualize the Central Limit Theorem. This theorem states that the mean of a large number of independent random variables with finite mean and variance exhibits a normal distribution.

First, generate uniformly distributed random variables in MATLAB® using the `rand` function. Find their distributions using the `histogram` function. At the MATLAB command line, type:

```numsamples = 1e4; numbins = 20; r = rand(numsamples,1); hst = histogram(r,numbins); ```

Create a new Array Plot object.

```scope = dsp.ArrayPlot; ```

Configure the properties of the Array Plot object to plot a histogram.

```scope = dsp.ArrayPlot; scope.XOffset = 0; scope.SampleIncrement = 1/numbins; scope.PlotType = 'Stem'; scope.YLimits = [0, max(hst)+1]; ```

Call the scope to plot the uniform distribution.

`scope(hst');`

The following Array Plot figure appears, showing a uniform distribution.

### Display the Sum of Many Uniform Distributions

Next, calculate the mean of multiple uniformly distributed random variables. As the number of random variables increases, the distribution more closely resembles a normal curve. Run the `release` method to let property values and input characteristics change. At the MATLAB command line, type:

```release(scope); ```

Change the configuration of the Array Plot properties for the display of a distribution function.

```numbins = 201; numtrials = 100; r = zeros(numsamples,1); scope.SampleIncrement = 1/numbins; scope.PlotType = 'Stairs'; ```

Call the scope repeatedly to plot the uniform distribution.

```for ii = 1:numtrials r = rand(numsamples,1)+r; hst = histogram(r/ii,0:1/numbins:1); scope.YLimits = [min(hst)-1, max(hst)+1]; scope(hst'); pause(0.1); end```

When the simulation has finished, the Array Plot figure displays a bell curve, indicating a distribution that is close to normal.

### Inspect Your Data by Zooming

The zoom tools allow you to zoom in simultaneously in the directions of both the x- and y-axes or in either direction individually. For example, to zoom in on the distribution between 0.3 and 0.7, you can use the option.

• To activate the tool, select Tools > Zoom X, or press the corresponding toolbar button (). You can determine if the tool is active by looking for an indented toolbar button or a check mark next to the Tools > Zoom X menu option.

• Next, zoom in on the region between 0.3 and 0.7. In the Array Plot window, click on the 0.3-second mark, and drag to the 0.7-second mark. The display reflects this new x-axis setting, as shown in the following figure.