-
Notifications
You must be signed in to change notification settings - Fork 2
/
show_MixFHMMR_results.m
43 lines (37 loc) · 1.21 KB
/
show_MixFHMMR_results.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
function show_MixFHMMR_results(data, mixFHMMR)
set(0,'defaultaxesfontsize',14);
[n, m] = size(data);
t = 0:m-1;
K = length(mixFHMMR.model.w_k);
colors = {'r','b','g','m','c','k','y'};
% colors_cluster_means = {'m','c','k','b','r','g'};
colors_cluster_means = {[0.8 0 0],[0 0 0.8],[0 0.8 0],'m','c','k','y'};
%%
scrsz = get(0,'ScreenSize');
figure('Position',[10 scrsz(4)/2 550 scrsz(4)/2.15]);
plot(t,data')
xlabel('t')
ylabel('y(t)')
title('original time series')
%
% clustered data and cluster meands
figure('Position',[scrsz(4) scrsz(4)/2 550 scrsz(4)/2.15]);
for k=1:K
cluster_k = data(mixFHMMR.stats.klas==k,:);
plot(t,cluster_k','color',colors{k},'linewidth',0.001);
hold on
% plot(t,solution.smoothed(:,k),'color',colors{k},'linewidth',3)
plot(t,mixFHMMR.stats.smoothed(:,k),'color',colors_cluster_means{k},'linewidth',3)
end
title('Clustered time series')
ylabel('y(t)')
xlabel('t')
%% clusters and cluster means
for k=1:K
cluster_k = data(mixFHMMR.stats.klas==k,:);
figure, plot(t,cluster_k','color',colors{k})
hold on, plot(t,mixFHMMR.stats.smoothed(:,k),'color',colors_cluster_means{k},'linewidth',3)
title(['Cluster ',int2str(k)])
ylabel('y(t)');
xlabel('t');
end