Filter data directly in scatter graph

I am new to MATLAB, I want to filter some data on the image I send attached, I tried to use smooth funciton but I think it only works with plot and I want to be able to use it with the scatter function. I know I can erase this dots manually with the brush/select data directly in the graph, the thing is I have tens of this graphs. I want to be able to filter them in the graph not in the workspace. Is it even possible to do this? thanks.

4 Kommentare

Adam Danz
Adam Danz am 13 Nov. 2018
Your image doesn't appear.
Adam Danz
Adam Danz am 13 Nov. 2018
Looks like the question was edited but the image still doesn't appear. I wonder if you're experiencing a glitch in the updated format of the website.
Sebastian Guzman
Sebastian Guzman am 13 Nov. 2018
Indeed I edited , I thought it has uploaded this time, I will upload it in here. cell11625C_25temp.jpg
Adam Danz
Adam Danz am 13 Nov. 2018
Bearbeitet: Adam Danz am 13 Nov. 2018
There's lots of approaches to this problem.
1) Smoothing. Smoothing will definitely clean up the data but you'll have a bump around x=~900 where those cluster of data points are and you'll lose some of the features of the data like the sudden steps around x=~2800 and x=~3500.
2) Fitting. If you know what the shape of the line "should" be, you can fit the data to a function. In that case you'll end up with a very smooth line but you'll lose all of the variation.
3) Removing outliers. Matlab has several algorithms for detecting outliers in your data. You could detect the outliers and then remove them. That will preserve the main features of your data. For example, if you're using matlab 2017a or later, see
doc isoutlier()
.
Depending on your approach, there's lots of functions, tools, etc that matlab offers. But first you should decide on an approach which depends on how the data will be used, interpreted, etc.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 14 Nov. 2018
Bearbeitet: KSSV am 14 Nov. 2018

0 Stimmen

Let (x,y) be your data.
stdDev = std(y) ; % Compute standard deviation
meanValue = mean(y) ; % Compute mean
zFactor = 1.5; % or whatever you want.
% indices where outliers are present
idx = abs(y-meanValue) > (zFactor * stdDev);
% remove outliers
x(idx) = [] ;
y(idx) = [] ;
plot(x,y,'.')

1 Kommentar

Adam Danz
Adam Danz am 14 Nov. 2018
This method doesn't work with the data Sebastian provided in the plot. This method would incorrectly get rid of data in the lower and upper ranges which is not what he's trying to do.

Melden Sie sich an, um zu kommentieren.

Kategorien

Produkte

Version

R2018a

Gefragt:

am 13 Nov. 2018

Kommentiert:

am 14 Nov. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by