Documentation Center

  • Trial Software
  • Product Updates


Student's t cumulative distribution function


p = tcdf(x,v)
p = tcdf(x,v,'upper')


p = tcdf(x,v) returns Student's t cdf at each value in x using the corresponding degrees of freedom in v. x and v can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs.

p = tcdf(x,v,'upper') returns the complement of the Student's t cdf at each value in x, using an algorithm that more accurately computes the extreme upper tail probabilities.

The t cdf is

The result, p, is the probability that a single observation from the t distribution with ν degrees of freedom will fall in the interval [–∞, x).


expand all

Compute Student's t cdf

mu = 1;     % Population mean
sigma = 2;  % Population standard deviation
n = 100;    % Sample size
x = normrnd(mu,sigma,n,1);  % Random sample from population
xbar = mean(x);  % Sample mean
s = std(x);      % Sample standard deviation
t =
p = 1-tcdf(t,n-1) % Probability of larger t-statistic
p =

This probability is the same as the p value returned by a t-test of the null hypothesis that the sample comes from a normal population with mean μ.

[h,ptest] = ttest(x,mu,0.05,'right')
h =
ptest =

See Also

| | | |

Was this topic helpful?