-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.m
110 lines (60 loc) · 2.14 KB
/
test.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
% base parameters
LG_mu = 2.2;
LG_sigma = .46;
PD_mu = -.43;
PD_sigma = .405;
sigma_scale = corelib.logrange(.04,2,100);
sigma_scale = linspace(0.04,2,100);
PD_LG_similarity = linspace(0,1,90);
N = 1e4;
DeviationFromUniform = zeros(length(sigma_scale),length(PD_LG_similarity));
for i = 1:length(sigma_scale)
corelib.textbar(i,length(sigma_scale))
for j = 1:length(PD_LG_similarity)
this_mu = LG_mu*(1-PD_LG_similarity(j)) + PD_mu*PD_LG_similarity(j);
LG = lognrnd(this_mu,LG_sigma*sigma_scale(i),1e5,1);
PD = lognrnd(PD_mu,PD_sigma*sigma_scale(i),1e5,1);
DeviationFromUniform(i,j) = mean(abs(histcounts(rem(LG./PD,1),linspace(0,1,100),'Normalization','pdf')-1));
end
end
figure('outerposition',[300 300 1200 600],'PaperUnits','points','PaperSize',[1200 600]); hold on
h = heatmap(PD_LG_similarity,sigma_scale,DeviationFromUniform,'GridVisible','off');
colormap parula
caxis([0 .2])
for i = 2:length(h.YDisplayLabels)
if rem(i,10) == 0
continue
end
h.YDisplayLabels{i} = '';
end
for i = 2:length(h.XDisplayLabels)
if rem(i,10) == 0
continue
end
h.XDisplayLabels{i} = '';
end
xlabel('Similairty of LP and PD')
ylabel('Variability in period relative to data')
figlib.pretty
figure('outerposition',[300 300 1800 600],'PaperUnits','points','PaperSize',[1800 600]); hold on
subplot(1,3,1); hold on
histogram(y,'Normalization','pdf','EdgeColor','none'); figlib.pretty; box off
subplot(1,3,2); hold on
histogram(x,'Normalization','pdf','EdgeColor','none'); figlib.pretty; box off
subplot(1,3,3); hold on
histogram(xx,'Normalization','pdf','EdgeColor','none'); figlib.pretty; box off
x = rand(1e6,1)+2;
y = rand(1e6,1)+11;
z = rem(y./x,1);
figure('outerposition',[300 300 1200 600],'PaperUnits','points','PaperSize',[1200 600]); hold on
subplot(1,3,1); hold on
histogram(x,'Normalization','pdf','NumBins',100,'EdgeColor','none')
xlabel('Denominator')
ylabel('pdf')
subplot(1,3,2); hold on
histogram(y,'Normalization','pdf','NumBins',100,'EdgeColor','none')
xlabel('Numerator')
subplot(1,3,3); hold on
histogram(z,'Normalization','pdf','NumBins',100,'EdgeColor','none')
xlabel('Significand of quotient')
figlib.pretty('FontSize',30)