Chi-square cumulative distribution function
p = chi2cdf(x,v)
p = chi2cdf(x,v,'upper')
p = chi2cdf(x,v) computes the chi-square cdf at each of the values in x using the corresponding degrees of freedom in v. x and v can be vectors, matrices, or multidimensional arrays that have the same size. The degrees of freedom parameters in v must be positive integers, and the values in x must lie on the interval [0 Inf]. A scalar input is expanded to a constant array with the same dimensions as the other input.
The χ2 cdf for a given value x and degrees-of-freedom ν is
where Γ( · ) is the Gamma function.
The chi-square density function with ν degrees-of-freedom is the same as the gamma density function with parameters ν/2 and 2.