To calculate the F distribution in MATLAB, you can use the functions fpdf
and fcdf
for the probability density function (PDF) and the cumulative distribution function (CDF), respectively.
The syntax for fpdf
is:
main.m18 chars2 lines
where x
is the vector of x-values, and v1
and v2
are the degrees of freedom parameters for the numerator and denominator, respectively.
The syntax for fcdf
is:
main.m18 chars2 lines
where x
is the vector of x-values, and v1
and v2
are the degrees of freedom parameters for the numerator and denominator, respectively.
Here is an example code that calculates and plots the F distribution for different values of v1
and v2
:
main.m599 chars31 lines
Here is the resulting figure:
gistlibby LogSnag