CDF of VOn Mises distribution
15 次查看(过去 30 天)
显示 更早的评论
Hello all,
How can I calculate cdf of Von Mises distribution with MATLAB?
Thanks
回答(3 个)
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
plot(theta,c)
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.
0 个评论
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
plot(-pi:.1:pi,double(cdf))
xlim([-pi pi]);
set(gca,'XTick',(-1:.5:1)*pi);
set(gca,'XMinorTick','on');
set(gca,'XMinorGrid','on');
grid
0 个评论
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 =
0.84863
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!