Categories &

Functions List

Function Reference: tcdf

statistics: p = tcdf (x, df)
statistics: p = tcdf (x, df, 'upper')

Student’s T cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the Student’s T distribution with df degrees of freedom. The size of p is the common size of x and df. A scalar input functions as a constant matrix of the same size as the other input.

p = tcdf (x, df, "upper") computes the upper tail probability of the Student’s T distribution with df degrees of freedom, at the values in x.

Further information about the Student’s T distribution can be found at https://en.wikipedia.org/wiki/Student%27s_t-distribution

See also: tinv, tpdf, trnd, tstat

Source Code: tcdf

Example: 1

Plot various CDFs from the Student's T distribution

 x = -5:0.01:5;
 p1 = tcdf (x, 1);
 p2 = tcdf (x, 2);
 p3 = tcdf (x, 5);
 p4 = tcdf (x, Inf);
 plot (x, p1, '-b', x, p2, '-g', x, p3, '-r', x, p4, '-m')
 grid on
 xlim ([-5, 5])
 ylim ([0, 1])
 legend ({'df = 1', 'df = 2', ...
          'df = 5', 'df = \infty'}, 'location', 'southeast')
 title ('Student''s T CDF')
 xlabel ('values in x')
 ylabel ('probability')
plotted figure