MATLAB Answers

CDF of VOn Mises distribution

17 ビュー (過去 30 日間)
Aep 2021 年 8 月 18 日
編集済み: David Goodmanson 2021 年 8 月 19 日
Hello all,
How can I calculate cdf of Von Mises distribution with MATLAB?
An explanation about Von Mises distribution is provided in this Wikipedia page.
  4 件のコメント
Aep 2021 年 8 月 18 日
Thanks @KSSV. I had searched in the circular statistics toolbox, however it seems that it does not calculate the CDF of Von Mises distribution. The other code that you sent also, as far as I understood, generates random Von Mises distribution, but it does not calculate CDF.


回答 (3 件)

David Goodmanson
David Goodmanson 2021 年 8 月 18 日
編集済み: David Goodmanson 2021 年 8 月 19 日
HI Aep,
This is straight numerical integration and provides the cdf at 1e6 equally spaced points in theta, from -pi to pi.
kappa = 3;
mu = 1;
theta = linspace(-pi,pi,1e6);
f = exp(kappa*cos(theta-mu))/(2*pi*besseli(0,kappa));
c = cumtrapz(theta,f); % cdf
c(end)-1 % check to see how close the last point of the cdf is to 1
ans = 2.0650e-14
% assume a set of angles theta1 with -pi <= theta1 <= pi;
theta1 = [.7 1.4 2.1];
c1 = interp1(theta,c,theta1,'spline')
c1 = 0.3148 0.7455 0.9578
For any reasonable kappa the last point of the cdf will be very close to 1, but the look of the plot depends on how far the maximum of f (at theta = mu) is from the starting point. Here the starting point is -pi, but it could be anywhere on the circle.
For an array of input angles of your choosing, interp1 provides the result.

Paul 2021 年 8 月 18 日
This code seems to recreate one of the CDF plots on the linked wikipedia page. It doesn't run very fast.
syms x mu kappa x0 real
syms j integer
phi(x,mu,kappa) = 1/2/sym(pi)*(x + 2/besseli(0,kappa)*symsum(besseli(j,kappa)*sin(j*(x-mu))/j,j,1,inf));
F(x,mu,kappa,x0) = phi(x,mu,kappa) - phi(x0,mu,kappa);
cdf = F(-pi:.1:pi,0,1,-pi); % mu = 0, kappa = 1, support from -pi to pi
xlim([-pi pi]);

Jeff Miller
Jeff Miller 2021 年 8 月 19 日
The Von Mises distribution is included in Cupid. You could use it like this to calculate CDF values:
>> location = 10;
>> concentration = 1.5;
>> vm = VonMises(location,concentration);
>> vm.CDF(11)
ans =

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by