Main Content

tpdf

Student'stprobability density function

Description

example

y= tpdf(x,nu)returns the probability density function (pdf) of the Student'stdistribution withnudegrees of freedom, evaluated at the values inx.

Examples

collapse all

The value of the pdf at the mode is an increasing function of the degrees of freedom.

The mode of the Student'stdistribution is atx= 0. Compute the pdf at the mode for degrees of freedom1to6.

tpdf(0,书1:6)
ans =1×60.3183 0.3536 0.3676 0.3750 0.3796 0.3827

Thetdistribution converges to the standard normal distribution as the degrees of freedom approach infinity.

Compute the difference between the pdfs of the standard normal distribution and the Student'stdistribution pdf with30的自由度。

difference = tpdf(-2.5:2.5,30)-normpdf(-2.5:2.5)
difference =1×60.0035 -0.0006 -0.0042 -0.0042 -0.0006 0.0035

Input Arguments

collapse all

Values at which to evaluate the pdf, specified as a scalar value or an array of scalar values.

  • To evaluate the pdf at multiple values, specifyxusing an array.

  • To evaluate the pdfs of multiple distributions, specifynuusing an array.

If either or both of the input argumentsxandnuare arrays, then the array sizes must be the same. In this case,tpdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inyis the pdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

Example:[-1 0 3 4]

Data Types:single|double

Degrees of freedom for the Student'stdistribution, specified as a positive scalar value or an array of positive scalar values.

  • To evaluate the pdf at multiple values, specifyxusing an array.

  • To evaluate the pdfs of multiple distributions, specifynuusing an array.

If either or both of the input argumentsxandnuare arrays, then the array sizes must be the same. In this case,tpdfexpands each scalar input into a constant array of the same size as the array inputs.Each element inyis the pdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

Example:[9 19 49 99]

Data Types:single|double

Output Arguments

collapse all

pdf values evaluated at the values inx, returned as a scalar value or an array of scalar values.pis the same size asxandnuafter any necessary scalar expansion.Each element inyis the pdf value of the distribution specified by the corresponding element innu, evaluated at the corresponding element inx.

More About

collapse all

Student’stpdf

The Student'stdistribution is a one-parameter family of curves. The parameterν的自由度。The Student'stdistribution has zero mean.

The pdf of the Student'stdistribution is

y = f ( x | ν ) = Γ ( ν + 1 2 ) Γ ( ν 2 ) 1 ν π 1 ( 1 + x 2 ν ) ν + 1 2 ,

whereνis the degrees of freedom and Γ( · ) is the Gamma function. The resultyis the probability of observing a particular value ofxfrom the Student’stdistribution withν的自由度。

For more information, seeStudent's t Distribution.

Alternative Functionality

  • tpdfis a function specific to the Student'stdistribution. Statistics and Machine Learning Toolbox™ also offers the generic functionpdf, which supports various probability distributions. To usepdf, specify the probability distribution name and its parameters. Note that the distribution-specific functiontpdfis faster than the generic functionpdf.

  • Use theProbability Distribution Functionapp to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a