Filter löschen
Filter löschen

Probability of occurrence as a function of distance

1 Ansicht (letzte 30 Tage)
Florian
Florian am 6 Mai 2020
Kommentiert: Florian am 8 Mai 2020
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 Kommentare
Walter Roberson
Walter Roberson am 6 Mai 2020
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 am 6 Mai 2020
Bearbeitet: Florian am 6 Mai 2020
HI Walter,
'color' is just a name for any attribute. The distance is in 1D, not 3D.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Mai 2020
findgroups() and grpstats(), probably with prctile()
  4 Kommentare
Walter Roberson
Walter Roberson am 8 Mai 2020
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 am 8 Mai 2020
Perfect, Walter! Thank you so much for providing this explanation!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Time Series finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by