フィルターのクリア

I need help grouping randomly oriented platelets into stacks using two different criteria.

2 ビュー (過去 30 日間)
Jonathan Salazar
Jonathan Salazar 2017 年 8 月 16 日
回答済み: Neil Guertin 2017 年 8 月 22 日
I am given a box full of platelets that are randomly oriented. I need to group the platelets by stacks. the criteria for staking is 1) that the distance between their midpoints is below a certain threshold(I am working on finding this value) and 2) that the absolute value of the scalar product between two of the normal vectors of the platelets is greater that .95. I have already written the code for finding the midpoint of each platelet and the normal vector of each platelet. what I am struggling with is actually grouping them together based on this criteria. i tried using D = squareform(pdist(platelet)) for the first criteria but i do not know how to get the information i need from the output. Thank you!
for k = 1 : num_tags % num_tags == number of platlets
platelet = find(mol_tag1 == unique_mol_tags(k));% groups atoms into platlets
xmid = mean(x(platelet));
ymid = mean(y(platelet));%takes mean of x,y,z coordinates in each platlet to find midpoint
zmid = mean(z(platelet));
midplat(k,:) = [xmid,ymid,zmid];% midpoint of each platlet
end
D = squareform(pdist(midplat));

回答 (1 件)

Neil Guertin
Neil Guertin 2017 年 8 月 22 日
Each platelet's location can be represented by a 1x6 vector, with the first three entries representing position as you have done, and the next three representing orientation as given by the normal vector.
You will then need to write a custom distance function. This should give the euclidean distance as usual for platelets in the same orientation, but give inf for platelets with different orientations. Read the documentation to make sure you are implementing this function correctly as it must accept a matrix representing multiple points as its second argument.
pdist just calculates the distances between points. To group them into clusters you will need to use the cluster and linkage functions.
X = [platelet_midpoints platelet_norms];
Z = linkage(X,method,@distance_function);
T = cluster(Z,'cutoff',n);

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by