![untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233306/untitled.png)
Help with creating clustering
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Lev Mihailov
el 9 de Ag. de 2019
Respondida: Neuropragmatist
el 9 de Ag. de 2019
Hello! I have a signal X1 and X2 I need to cluster it by depth and distance, I tried k average but, they told me that you can’t do this, tell me how best to do this
X1=[12 13 22 14 15 22]
X2=[11 12 29 0 14 31]
Y=[X1;X2];
0 comentarios
Respuesta aceptada
Neuropragmatist
el 9 de Ag. de 2019
I think the biggest problem here is that you have very few data points.
Have you tried looking at the various options on this page:
In 2 minutes I cooked this together without any care or thought, so I'm sure you can make something even better suited to your data:
% your data
X1=[12 13 22 14 15 22];
X2=[11 12 29 0 14 31];
Y=[X1(:) X2(:)]; % I changed this to be Mx2
figure
subplot(1,2,1)
plot(Y(:,1),Y(:,2),'ko') % plot the original data
axis([min(Y(:,1))-3 max(Y(:,1))+3 min(Y(:,2))-3 max(Y(:,2))+3])
Z = linkage(Y); % see: https://uk.mathworks.com/help/stats/linkage.html
T = cluster(Z,'cutoff',15,'Criterion','distance'); % see: https://uk.mathworks.com/help/stats/cluster.html
subplot(1,2,2)
gscatter(Y(:,1),Y(:,2),T) % plot the clustered data
axis([min(X1(:))-3 max(X1(:))+3 min(X2(:))-3 max(X2(:))+3])
![untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233306/untitled.png)
Hope this helps,
M.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!