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.
For the Kolmogorov-Smirnov goodness-of-fit test, MuPAD® provides
This function enables you to test the data against any cumulative
distribution available in the MuPAD Statistics library.
The Kolmogorov-Smirnov test returns two p-values. The null hypothesis
passes the test only if both values are larger than the significance
level. For example, create the following data sequence
contains a thousand entries:
f := stats::normalRandom(1, 1/3): x := f() $ k = 1..1000:
Use the function
test whether the sequence
x has a normal distribution
with the mean 1 and the variance 1/3. Suppose, you apply the typical
significance level 0.05. Since both p-values are larger than the significance
level, the sequence passes the test:
stats::ksGOFT(x, CDF = stats::normalCDF(1, 1/3))
Test the same sequence, but this time compare it to the normal
distribution with the variance 1. Both p-values are much smaller than
the significance level. The null hypothesis states that the sequence
a normal distribution with the mean 1 and the variance 1. This hypothesis
must be rejected:
stats::ksGOFT(x, CDF = stats::normalCDF(1, 1))