Probability of occurrence as a function of distance

1 次查看(过去 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
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.
Florian
Florian 2020-5-6
编辑:Florian 2020-5-6
HI Walter,
'color' is just a name for any attribute. The distance is in 1D, not 3D.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2020-5-6
findgroups() and grpstats(), probably with prctile()
  4 个评论
Walter Roberson
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 ?
Florian
Florian 2020-5-8
Perfect, Walter! Thank you so much for providing this explanation!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by