-
Notifications
You must be signed in to change notification settings - Fork 3
/
showDistributions.m~
57 lines (43 loc) · 1.14 KB
/
showDistributions.m~
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
function showDistributions(EV, nGroups, eps, cols)
% params
ftsz = 20;
numDim = 2;
lw = 3;
mrkSz = 10;
m = size(EV,1);
mGroup = m / nGroups;
D = zeros(1,size(EV,1));
nn = 0;
for i = 1:size(EV,1)
for j = i+1:size(EV,1)
nn = nn+1;
f1 = EV(i,:) + eps;
f2 = EV(j,:) + eps;
f1 = log(f1);
f2 = log(f2);
D(nn) = mean(abs(f1 - f2));
end
end
DM = squareform(D);
[md, st] = mdscale(DM, numDim);
fprintf('MDS Stress: %d\n', st);
pdf = {};
xi = {};
for i = 1:nGroups
sel = (i-1)*mGroup+1 : i*mGroup;
[pdf{i}, xi{i}] = ksdensity(md(sel,:));
end
figure
hold on
for i = 1:nGroups
X = reshape(xi{i}(:,1), 30, 30);
Y = reshape(xi{i}(:,2), 30, 30);
F = reshape(pdf{i}, 30, 30);
contour(X,Y,F,3, 'col', cols{i}, 'LineStyle', '-', 'LineWidth', 2)
end
xlabel('1st MDS coordinate', 'FontSize', ftsz)
ylabel('2nd MDS coordinate', 'FontSize', ftsz)
%leg = legend('All Data','Tide Dominated','Coarse Sand');
%leg.set('FontSize', ftsz);
set(gca, 'FontSize', ftsz);
end