-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathhelperPlotClusters.m
More file actions
27 lines (25 loc) · 879 Bytes
/
Copy pathhelperPlotClusters.m
File metadata and controls
27 lines (25 loc) · 879 Bytes
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
function helperPlotClusters(X, idx, C)
% HELPERPLOTCLUSTER Helper function for cluster plotting
%
% This function supports the Similarity-based Remaining Useful Life
% Estimation example. It may change in a future release.
% Copyright 2017-2018 The MathWorks, Inc.
if(nargin>1)
hold on
for i = 1:max(idx)
scatter3(X{idx==i,1}, X{idx==i,2}, X{idx==i,3});
end
scatter3(C(:,1),C(:,2),C(:,3), 'x', 'MarkerFaceColor', [0 0 0], ...
'MarkerEdgeColor', [0 0 0], 'LineWidth', 2);
legendStr = ["Cluster "+(1:6), "Centroids"];
legend(cellstr(legendStr), 'Location', 'NW');
hold off
view(-30,30)
grid on
else
scatter3(X{:,1}, X{:,2}, X{:,3});
end
xlabel(X.Properties.VariableNames{1}, 'Interpreter', 'none')
ylabel(X.Properties.VariableNames{2}, 'Interpreter', 'none')
zlabel(X.Properties.VariableNames{3}, 'Interpreter', 'none')
end