forked from Bounciness/Volume-and-Sampling
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotDistribution.m
More file actions
28 lines (25 loc) · 764 Bytes
/
PlotDistribution.m
File metadata and controls
28 lines (25 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function [] = PlotDistribution( pts , plotHandle)
%PLOTDISTRIBUTION Plot the distribution of pts
% np = min([its(i) P]);
np = size(pts,1);
h = 15;
X = linspace(min(pts(1:np,1)),max(pts(1:np,1)),h);
Y = linspace(min(pts(1:np,2)),max(pts(1:np,2)),h);
Z = zeros(h,h);
for ij=1:np
[~,x_ind] = min(abs(X-pts(ij,1)));
[~,y_ind] = min(abs(Y-pts(ij,2)));
mult = 1;
if x_ind==1 || x_ind==h
mult = mult*2;
end
if y_ind==1 || y_ind ==h
mult = mult*2;
end
Z(y_ind,x_ind) = Z(y_ind,x_ind)+mult/np*(h-1)^2;
end
figure(plotHandle);
surf(X,Y,Z);
drawnow;
axis([X(1) X(end) Y(1) Y(end) 0 1.25*max(max(Z))]);
end