C8: approximate dartboard marginalizations

We first transform a regularly-spaced sampled Gaussian using the inverse transform.

%%% prelim

r=[2.5 4.5];

angs=linspace(0,2*pi,41); angs0=angs+angs(2)/2;

dists=0:2:50; dists0=dists+dists(2)/2;

[R0 A0]=meshgrid(dists0,angs0); [X0s Y0s]=pol2cart(A0,R0);

[R A]=meshgrid(dists,angs); [Xs,Ys]=pol2cart(A,R);

X=[Xs(:) Ys(:)]; X0=[X0s(:) Y0s(:)];

mu=[0 0]; sigma=[30 0; 0 140];

p=mvnpdf(X,mu,sigma); p0=mvnpdf(X0,mu,sigma);

Ps=reshape(p,length(angs),length(dists)); P0s=reshape(p0,length(angs0),length(dists0));

%%% plot original distribution

figure(6); clf; hold on

mesh(Xs,Ys,Ps); colormap(bone);

plot3(X0s(:),Y0s(:),1.075*P0s(:),'k.');

axis([-51 51 -51 51]); view(-36.6,54)

%%% plot transformed (angle-distance) distribution

figure(7); clf; hold on

mesh(A,R,Ps.*R); colormap(bone);

plot3(A0(:),R0(:),P0s(:).*R0(:),'k.');

axis([0 2*pi 0 51]); view(-29,50)

%%% plot lossy distance transform

figure(8); clf; hold on

plot([0 dists0],[0; str8n(sum(P0s.*R0,1))],'ko--','MarkerFaceColor','k','MarkerSize',10)

axis([0 50 0 .45])

%%% plot lossy angle transform

figure(9); clf; hold on

plot(angs0,str8n(sum(P0s.*R0,2)),'ko--','MarkerFaceColor','k','MarkerSize',10)

axis([0 1.02*2*pi 0 .18])