Finding the predominant value in multiple sets of data

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 件のコメント

Dyuman Joshi
Dyuman Joshi 2023 年 8 月 20 日
You can replace the outlier using filloutliers, by the mean or median values of previous, next or neighbouring elements.
How is the data stored? If possible, can you attach your data using the paperclip button.
dpb
dpb 2023 年 8 月 20 日
What's the determination of what is an outlier/error -- the population of points at a given C value or the linearity (or lack thereof) of the trend line for each set of observations?
Saeid
Saeid 2023 年 8 月 21 日
I know it is a bit difficult to answer that question, but something like the peak in the dataset that I have shown is definitely an outlier.
Dyuman Joshi
Dyuman Joshi 2023 年 8 月 22 日
That's not a distinct determination, you are relying on visuals, not mathematics.
Say the data point was near 2, instead of being near 2.2, would it be considered an outlier? If yes, then on what basis? If no, then on what basis?
You will have to define for how much deviation should a data point be considered an outlier.
As I suggested earlier, experiment with filloutliers.
Saeid
Saeid 2023 年 8 月 22 日
I already did, and it works for this case. Thank you!
dpb
dpb 2023 年 8 月 22 日
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?

サインインしてコメントする。

回答 (1 件)

claudio
claudio 2023 年 8 月 20 日

0 投票

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)]);

カテゴリ

製品

リリース

R2023a

質問済み:

2023 年 8 月 20 日

コメント済み:

dpb
2023 年 8 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by