matlab kstest
时间: 2023-08-20 13:05:45 浏览: 213
Kolmogorov-Smirnov test (K-S test) is a statistical test used to determine whether a sample comes from a specific distribution. In MATLAB, you can use the "kstest" function to the K-S test. The syntax is:
```matlab
[h, p, ksstat] = kstest(data, 'cdf')
```
Here, "data" is the sample data you want to test, and 'cdf' is the name of the cumulative distribution function (CDF) you want to compare the data against. The output "h" is the test decision (1 if null hypothesis rejected, 0 otherwise), "p" is the p-value of the test, and "ksstat" is the test statistic.
For example, if you have a sample "data" and want to test whether it follows a normal distribution, you can use:
```matlab
[h, p, ksstat] = kstest(data, 'norm')
```
This will perform the K-S test comparing the sample data against the normal distribution.
阅读全文