# Finding the predominant value in multiple sets of data

2 Ansichten (letzte 30 Tage)
Saeid am 20 Aug. 2023
Kommentiert: dpb am 22 Aug. 2023
I have multiple sets of XY data that look like the following graph, where each set has a different color. The maximum of the blue lines is an error and it should be at the same level as the black and red lines (i.e. around 1.9). The same may appliey to the minimum of the green line, which is erroneous, but it is not as critical as the blue line since at least it shows a monotnous increase. If I calculate the avreage of all values I will be entering spme unwanted error into the whole set, and the maximum of the blue curves will influence that average. How can I automatically make the program decide to bring the blue line also to the same level as the red and black ones?
##### 6 Kommentare4 ältere Kommentare anzeigen4 ältere Kommentare ausblenden
Saeid am 22 Aug. 2023
I already did, and it works for this case. Thank you!
dpb am 22 Aug. 2023
The Q? is one of fundamental concept -- is it the population of points at each level of C or the correlation of A vs C for each unique set?

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

claudio am 20 Aug. 2023
if I have correctly interpreted the request
% assuming all the lines have the same
% number of elements
% (numel(blueLine) = numel(redLine) ...
[maxBlueLine,idxMaxBlueLine] = max(blueLine); % locate the position of the incorrect value in the blue line
blueLine(idxMaxBlueLine) = redLine(idxMaxBlueLine); % alternatively one of the following assign the correct value
blueLine(idxMaxBlueLine) = blackLine(idxMaxBlueLine);
blueLine(idxMaxBlueLine) = mean([redLine(idxMaxBlueLine) blackLine(idxMaxBlueLine)]);
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Descriptive Statistics finden Sie in Help Center und File Exchange

R2023a

### Community Treasure Hunt

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

Start Hunting!

Translated by