To perform a one-sample t-test in Matlab, you can use the ttest
function.
Here's an example code snippet that demonstrates how to perform a one-sample t-test on a sample data:
main.m418 chars18 lines
In the above code, the ttest
function takes two arguments: the sample data, and the null hypothesis mean. The returned outputs are the t statistic, p-value, confidence interval, and other statistics related to the test.
Note that h
is the output for the test decision (0 for "cannot reject null hypothesis" and 1 for "reject null hypothesis").
gistlibby LogSnag