-
Notifications
You must be signed in to change notification settings - Fork 0
/
ratioBased.m
103 lines (96 loc) · 3.28 KB
/
ratioBased.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
% ratioBased: plots all ratio-based scaling exponents
% plots scale factor vs relative frequency
%HISTORY
% Jocie Shen, 7/11/16, first written
%============================================================
clear all; close all; clc;
cName = 'patient3_c.txt';
aName = 'patient3.txt';
%Ratio-based method: Scaling exponent a
figure
arr = fillArr(2, 'r', 'C++', cName);
[bins, frequency] = getBinFreq(arr, 2);
bar(bins, frequency, 1);
title('Ratio-based calculation of a (C++)','fontweight','bold');
xlabel('Radius scale factor','fontweight','bold') % x-axis label
ylabel('Relative frequency','fontweight','bold') % y-axis label
x1 = mean(arr);
y1=get(gca,'ylim');
hold on
a1 = plot([x1 x1],y1, 'r-', 'LineWidth', 1);
x2 = median(arr);
y2=get(gca,'ylim');
a2 = plot([x2 x2],y2, '-.g', 'LineWidth', 1);
legend('Relative frequency','mean', 'median');
exp1 = -log(x1)/log(2);
exp2 = -log(x2)/log(2);
formatSpec = 'a (C++) %4.2f (mean)\n';
fprintf(formatSpec,exp1)
formatSpec = 'a (C++) %4.2f (median)\n';
fprintf(formatSpec,exp2)
%Ratio-based method: Scaling exponent b
figure
arr = fillArr(2, 'l', 'C++', cName);
[bins, frequency] = getBinFreq(arr, 2);
bar(bins, frequency, 1);
title('Ratio-based calculation of b (C++)','fontweight','bold');
xlabel('Length scale factor','fontweight','bold') % x-axis label
ylabel('Relative frequency','fontweight','bold') % y-axis label
x1 = mean(arr);
y1=get(gca,'ylim');
hold on
a1 = plot([x1 x1],y1, 'r-', 'LineWidth', 1);
x2 = median(arr);
y2=get(gca,'ylim');
a2 = plot([x2 x2],y2, '-.g', 'LineWidth', 1);
legend('Relative frequency','mean', 'median');
exp1 = -log(x1)/log(2);
exp2 = -log(x2)/log(2);
formatSpec = 'b (C++) %4.2f (mean)\n';
fprintf(formatSpec,exp1)
formatSpec = 'b (C++) %4.2f (median)\n';
fprintf(formatSpec,exp2)
%ANGICART Ratio-based method: Scaling exponent a
figure
arr = fillArr(2, 'r', 'angicart', aName);
[bins, frequency] = getBinFreq(arr, 2);
bar(bins, frequency, 1);
title('Ratio-based calculation of a (angicart)','fontweight','bold');
xlabel('Radius scale factor','fontweight','bold') % x-axis label
ylabel('Relative frequency','fontweight','bold') % y-axis label
x1 = mean(arr);
y1=get(gca,'ylim');
hold on
a1 = plot([x1 x1],y1, 'r-', 'LineWidth', 1);
x2 = median(arr);
y2=get(gca,'ylim');
a2 = plot([x2 x2],y2, '-.g', 'LineWidth', 1);
legend('Relative frequency','mean', 'median');
exp1 = -log(x1)/log(2);
exp2 = -log(x2)/log(2);
formatSpec = 'a (angicart) %4.2f (mean)\n';
fprintf(formatSpec,exp1)
formatSpec = 'a (angicart) %4.2f (median)\n';
fprintf(formatSpec,exp2)
%ANGICART Ratio-based method: Scaling exponent b
figure
arr = fillArr(2, 'l', 'angicart', aName);
[bins, frequency] = getBinFreq(arr, 2);
bar(bins, frequency, 1);
title('Ratio-based calculation of b (angicart)','fontweight','bold');
xlabel('Length scale factor','fontweight','bold') % x-axis label
ylabel('Relative frequency','fontweight','bold') % y-axis label
x1 = mean(arr);
y1=get(gca,'ylim');
hold on
a1 = plot([x1 x1],y1, 'r-', 'LineWidth', 1);
x2 = median(arr);
y2=get(gca,'ylim');
a2 = plot([x2 x2],y2, '-.g', 'LineWidth', 1);
legend('Relative frequency','mean', 'median');
exp1 = -log(x1)/log(2);
exp2 = -log(x2)/log(2);
formatSpec = 'b (angicart) %4.2f (mean)\n';
fprintf(formatSpec,exp1)
formatSpec = 'b (angicart) %4.2f (median)\n';
fprintf(formatSpec,exp2)