## Perform t-Test

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.

The t-Test compares the actual mean value of a data sample with the specified value m. The null hypothesis for this test states that the actual mean value is larger than m. For the t-Test, MuPAD® provides the stats::tTest function. For example, create the normally distributed data sequence of 1000 entries by using the stats::normalRandom function:

f := stats::normalRandom(1, 2):
x := [f() \$ k = 1..1000]:

Now, use the stats::tTest function to test whether the actual mean value of x is larger than 1. Use the significance level 0.05. The returned p-value indicates the hypothesis passes the t-Test since the p-value exceeds the significance level.

stats::tTest(x, 1)

With the same significance level 0.05, the hypothesis that the actual mean value is larger than 2 does not pass the t-Test:

stats::tTest(x, 2)

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos