-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_plotAgeGroupFunctionalBOSModels.m
More file actions
183 lines (146 loc) · 4.93 KB
/
main_plotAgeGroupFunctionalBOSModels.m
File metadata and controls
183 lines (146 loc) · 4.93 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
%%
% SPDX-FileCopyrightText: 2024 Matthew Millard <millard.matthew@gmail.com>
%
% SPDX-License-Identifier: MIT
%
%%
clc;
close all;
clear all;
fbosFolder ='normBosModelsYoungMidageOlderAdults';
lineSpecs.footwear=[1,0,0; ...
0.66,0,0;
0.33,0,0];
lineSpecs.barefoot=[0,0,1;...
0,0,0.66;...
0,0,0.33];
lineSpecs.twofeet='-';
lineSpecs.onefoot='--';
%%
% Set up directories
%%
mainDir = pwd;
codeDir = fullfile(mainDir,'code');
dataDir = fullfile(mainDir,'data');
outputDir= fullfile(mainDir,'output');
addpath('code');
%%
% Plot configuration
%%
numberOfPlots = 1;
numberOfVerticalPlotRows = 1;
numberOfHorizontalPlotColumns = 1.;
plotWidth = 5;
plotHeight = 2.82*plotWidth; %2.82 is approx footlength/footwidth
plotHorizMarginCm = 3;
plotVertMarginCm = 3;
[subPlotPanel,pageWidth,pageHeight] = ...
plotConfigGeneric(numberOfHorizontalPlotColumns, ...
numberOfVerticalPlotRows,...
plotWidth,...
plotHeight,...
plotHorizMarginCm,...
plotVertMarginCm);
%%
% Fetch the list of files
%%
fbosDataDir = fullfile(dataDir,fbosFolder);
fbosDataDirFileList = dir(fbosDataDir);
fbosFiles = [];
for idxFile=1:1:length(fbosDataDirFileList)
if(contains(fbosDataDirFileList(idxFile).name,'.csv'))
fbosFiles = [fbosFiles,{fbosDataDirFileList(idxFile).name}];
end
end
figH =figure;
fbosModels(length(fbosFiles)) = struct('data',[],'n',0,...
'ageGroup','','footwear','','stance','','markerSet','','study','');
%%
% Read the data in
%%
idx=1;
for idxFile=1:1:length(fbosFiles)
if(contains(fbosFiles{idxFile},'.csv'))
fname = fbosFiles{idxFile};
fileWords = strsplit(fname(1,1:(end-4)),'_');
fbosModels(idx).data = ...
readmatrix(fullfile(fbosDataDir, fbosFiles{idxFile}));
fbosModels(idx).n = str2double(fileWords{2}(1,1:2));
fbosModels(idx).ageGroup = fileWords{2}(1,3:end);
fbosModels(idx).footwear = fileWords{3};
fbosModels(idx).stance = fileWords{4};
fbosModels(idx).markerSet = fileWords{5};
fbosModels(idx).study = fileWords{6};
idx=idx+1;
end
end
%%
% Plot the data
%%
idxYA = 0;
xTickList = [0];
yTickList = [0];
for idx=1:1:length(fbosModels)
if( contains(fbosModels(idx).footwear,'Footwear') ...
&& contains(fbosModels(idx).stance,'2Feet') ...
&& contains(fbosModels(idx).study,'Sloot2025') )
lineColor = [];
switch fbosModels(idx).ageGroup
case 'YoungAdults'
lineColor = [0,0,0];
case 'MidageAdults'
lineColor = [1,1,1].*0.75;
case 'OlderAdults'
lineColor = [68,119,170]./255;
otherwise
assert(0,'Error: Unrecognized age group');
end
idxAdult = strfind(fbosModels(idx).ageGroup,'Adults');
ageStr = fbosModels(idx).ageGroup(1,1:(idxAdult-1));
displayName = [ageStr, '(n=',num2str(fbosModels(idx).n),')'];
displayName = [displayName, '-',fbosModels(idx).study];
subplot('Position',reshape(subPlotPanel(1,1,:),1,4));
plot(fbosModels(idx).data(:,1),...
fbosModels(idx).data(:,2),'-',...
'Color',lineColor,...
'DisplayName',displayName,...
'LineWidth',2);
hold on;
xTickList = [xTickList,min(fbosModels(idx).data(:,1)),...
max(fbosModels(idx).data(:,1))];
yTickList = [yTickList,min(fbosModels(idx).data(:,2)),...
max(fbosModels(idx).data(:,2))];
end
xTickList = unique(round(sort(xTickList),2));
yTickList = unique(round(sort(yTickList),2));
end
subplot('Position',reshape(subPlotPanel(1,1,:),1,4));
box off;
legend('Location','northwest');
legend box off;
axis tight;
xyLim = axis;
xMid = 0.5*(xyLim(1,1)+xyLim(1,2));
xHWidth = 0.5*(xyLim(1,2)-xyLim(1,1));
xExt = [(xMid-xHWidth*1.1),(xMid+xHWidth*1.1)];
yMid = 0.5*(xyLim(1,3)+xyLim(1,4));
yHWidth = 0.5*(xyLim(1,4)-xyLim(1,3));
yExt = [(yMid-yHWidth),(yMid+yHWidth*1.2)];
xlim(xExt);
ylim(yExt);
plot([min(xExt),max(xExt)],[0,0],'-','Color',[1,1,1].*0.75,...
'HandleVisibility','off');
hold on;
plot([0,0],[min(yExt),max(yExt)],'-','Color',[1,1,1].*0.75,...
'HandleVisibility','off');
hold on;
xticks(xTickList);
xtickangle(90);
yticks(yTickList);
xlabel('Norm. X (x/foot-width)');
ylabel('Norm. Y (y/foot-length)');
title({'A. Comparison of 2-foot shod fBOS profiles of',...
'younger, middle-aged, and older adults'});
figH=plotExportConfig(figH,pageWidth,pageHeight);
fileName = fullfile( outputDir,'fig_fbos_YoungerMiddleAgedOlderAdults.pdf');
print('-dpdf', fileName);