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 个评论
Adam Danz
2018-11-13
Your image doesn't appear.
Adam Danz
2018-11-13
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
2018-11-13
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.
回答(1 个)
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 个评论
类别
在 帮助中心 和 File Exchange 中查找有关 Spline Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
