Documentation

## Create Quantile-Quantile Plots

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Quantile-quantile plots help you determine whether two samples come from the same distribution family. Quantile-quantile plots are scatter plots of quantiles computed from each sample together with a reference line along the diagonal of the plot. If the data forms the line, it is reasonable to assume that the two samples come from the same distribution family. If the data falls near the reference line, you also can assume that the two samples have the same mean and the same variance.

To create a quantile-quantile plot, use the `plot::QQplot` function. For example, create the data samples `data1` and `data2` that contain random floating-point numbers from the interval [0.0, 1.0). Use the `frandom` function to create the `data1` sample. Use the `stats::uniformRandom` function to create the `data2` sample. Both functions produce uniformly distributed numbers. The quantile-quantile plot of these two data samples confirms that the samples come from the same distribution family. The plot is close to the line with a slope of 1:

```data1 := [frandom() \$ i = 1..100]: data2 := [stats::uniformRandom(0, 1)() \$ k = 1..100]: p := plot::QQplot(data1, data2): plot(p)``` The following quantile-quantile plot clearly shows that these two data samples come from different distribution families:

```data1 := [stats::uniformRandom(0, 1)() \$ k = 1..100]: data2 := [stats::exponentialRandom(0, 1)() \$ k = 1..100]: p := plot::QQplot(data1, data2): plot(p)``` #### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos