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!