-
Notifications
You must be signed in to change notification settings - Fork 1
/
mcplotpqom.m
134 lines (115 loc) · 3.7 KB
/
mcplotpqom.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
function mcplotpqom(PQoM_Buffer, pqom_parameters)
% Plots PQoM per frequency band.
%
% syntax
% mcplotpqom(PQoM_Buffer, pqom_parameters);
%
% input parameters
% PQoM_Buffer: buffer containing the PQoM by frequency band
% pqom_parameters: parameters used to estimated the PQoM
%
% output
% figure
%
% example
% see demo_mcpqom.m
%
% comments
% the inputs parameters are generated by the output of the "mcpqom" function
%
% see also
% mcpqom
%
% ===============================================
% Version 1.0
% July 2015
% ===============================================
% Rodrigo Schramm (rodrigo.schramm@gmail.com) and Federico Visi (federico.visi@plymouth.ac.uk)
% UFRGS / Brazil CMMR / Plymouth University / UK
%
% Part of the Motion Capture Toolbox, Copyright 2008,
% University of Jyvaskyla, Finland
%%% plot PQoM per band
%===============================================
fWn = pqom_parameters.fWn;
noteType = pqom_parameters.noteType;
bpm = pqom_parameters.bpm;
fs = pqom_parameters.fs;
noteDiv = pqom_parameters.noteDiv;
ws = pqom_parameters.ws;
hs = pqom_parameters.hs;
markerName = pqom_parameters.markerName;
%===============================================
color='rgbkmrgbkmrgbkmrgbkmrgbkmrgbkm';
str = ['Markers: '];
for n=1:length(markerName)
str = [str, ' ', markerName{n},','];
end
str = str(1:end-1);
% for k=1:size(pqom_buffer,2)-1
% plot(pqom_buffer(:,k), color(k));
% end
fh1 = figure('Name','Periodic Quantity of Motion','NumberTitle','on');
hold on;
for k=1:size(PQoM_Buffer,2)-1
plot(PQoM_Buffer(:,k), color(k));
end
ax = gca;
set(ax,'XTick',1:size(PQoM_Buffer,1));
set(ax,'XTickLabel', [1:size(PQoM_Buffer,1)]*(hs/fs));
xlabel('time position (seconds)');
ylabel('PQoM');
set(ax,'XTick',1:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1));
%set(ax,'XTickLabel', [0:size(buffer,1)]*(hs/fs));
set(ax,'XTickLabel', [0:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1)]*(hs/fs));
xlabel(['time position (seconds) bpm=', num2str(bpm)]);
a = axis; a(1) = 0; a(2) = size(PQoM_Buffer,1);
axis(a);
title(str, 'interpreter', 'none');
legend( noteType{1:end-1});
%===============================================
%%% color map per band
fh2 = figure('Name','Periodic Quantity of Motion','NumberTitle','on'); hold on;
sfh2 = subplot(2,1,2);
sfh2.Position = [0.1 0.1 0.85 0.1];
ax = gca;
imagesc(PQoM_Buffer(:,end)');
set(ax,'YTick',1);
set(ax,'YTickLabel',noteType{end});
set(ax,'XTick',1:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1));
set(ax,'XTickLabel', [0:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1)]*(hs/fs));
a = axis; a(1) = 0; a(2) = size(PQoM_Buffer,1);
axis(a);
hcb=colorbar;
yt = get(hcb,'YTick');
cblabels={};
for k=1:length(yt)
cblabels{k} = sprintf("%s/s",num2str(yt(k)));
end
set(hcb,'YTick',yt);
set(hcb,'YTickLabel',cblabels);
sfh1 = subplot(2,1,1);
sfh1.Position = [0.1 0.3 0.85 0.6];
%ah1 = axes('Parent',fh2,'Units','normalized','Position',[0.1 0.3 0.8 0.6]);
%ah1 = axes(sfh1,'Units','normalized','Position',[0.1 0.3 0.8 0.6]);
imagesc(PQoM_Buffer(:,1:end-1)');
ax = gca;
set(ax,'YTick',1:size(PQoM_Buffer,2));
set(ax,'YTickLabel',noteType);
ylabel('freq band (note division)');
set(ax,'XTick',1:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1));
%set(ax,'XTickLabel', [0:size(buffer,1)]*(hs/fs));
set(ax,'XTickLabel', [0:size(PQoM_Buffer,1)/10:size(PQoM_Buffer,1)]*(hs/fs));
xlabel(['time position (seconds) bpm=', num2str(bpm)]);
a = axis; a(1) = 0; a(2) = size(PQoM_Buffer,1);
axis(a);
hcb=colorbar;
yt = get(hcb,'YTick');
cblabels={};
for k=1:length(yt)
cblabels{k} = sprintf("%s/s",num2str(yt(k)));
end
set(hcb,'YTick',yt);
set(hcb,'YTickLabel',cblabels);
title(str, 'interpreter', 'none');
end