Probability of occurrence as a function of distance
2 ビュー (過去 30 日間)
古いコメントを表示
Assume
% each color type represented by another integer
color=[5;3;4;3;5;4;4;5;16;4;16;4;16;16;16;4;16;16];
% corresponding distance in meters at which the color values occur away from point of origin zero.
distance=[0.3;0.9;4.2;5.1;7;8.8;12;15.3;19;26.1;27;29.6;34;36;41;43;51;58];
How can I calculate which color number is more likely to occur closer to distance 0 and which one further away from it and plot the results in a distribution plot with P10, P50 and P90 for each color?
PS: I use Matlab R2018b including Statistics and Machine Learning Toolbox.
PS2: please provide an answer which works with these two simple input arrays
2 件のコメント
Walter Roberson
2020 年 5 月 6 日
Are pixels constant size? If so then adjustment needs to be made for the fact that there are more pixels at a given radius as you get further away. You could, for example, weight each count by dividing it by the square of the distance it occurs at. However, you were indeed talking about probability of counts occuring in circular rings around an origin, I would expect to see a number of distances that were nearly the same.
採用された回答
Walter Roberson
2020 年 5 月 6 日
findgroups() and grpstats(), probably with prctile()
4 件のコメント
Walter Roberson
2020 年 5 月 8 日
You do not even need the cell wrapper.
% each color type represented by another integer
color=[5;3;4;3;5;4;4;5;16;4;16;4;16;16;16;4;16;16];
% corresponding distance in meters at which the color values occur away from point of origin zero.
distance=[0.3;0.9;4.2;5.1;7;8.8;12;15.3;19;26.1;27;29.6;34;36;41;43;51;58];
[G, ID] = findgroups(color);
stats = [ID, splitapply(@(M) prctile(M, [10 50 90]), distance, G)];
stats =
3 0.9 3 5.1
4 4.66 19.05 41.66
5 0.3 7 15.3
16 20.6 36 56.6
I am not sure how much easier you are striving for ?
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!