Function Reference: cauchypdf

statistics: y = cauchypdf (x, x0, gamma)

Cauchy probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the Cauchy distribution with location parameter x0 and scale parameter gamma. The size of y is the common size of x, x0, and gamma. A scalar input functions as a constant matrix of the same size as the other inputs.

Further information about the Cauchy distribution can be found at https://en.wikipedia.org/wiki/Cauchy_distribution

See also: cauchycdf, cauchypdf, cauchyrnd

Source Code: cauchypdf

Example: 1

 

 ## Plot various PDFs from the Cauchy distribution
 x = -5:0.01:5;
 y1 = cauchypdf (x, 0, 0.5);
 y2 = cauchypdf (x, 0, 1);
 y3 = cauchypdf (x, 0, 2);
 y4 = cauchypdf (x, -2, 1);
 plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", x, y4, "-c")
 grid on
 xlim ([-5, 5])
 ylim ([0, 0.7])
 legend ({"x0 = 0, γ = 0.5", "x0 = 0, γ = 1", ...
          "x0 = 0, γ = 2", "x0 = -2, γ = 1"}, "location", "northeast")
 title ("Cauchy PDF")
 xlabel ("values in x")
 ylabel ("density")

                    
plotted figure