Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Matlab: Eliminating freak values in dataset

Tags:

filter

matlab

I am searching for a method to eliminate freak values out of given dataset. For example:

Dataset to be filtered

All these peaks should be eliminated. I've tried different filters like medfilt, but the peaks are still there. I've also tried a lowpass filter, but it didn't work either. I am a beginner in filtering signals, so I probably did it wrong.

You can download data sets for the x array here and y array here.

I could also imagine a loop to compare the values next to each other, but I am sure there has to be a built-in function?

Here is the result using medfilt1(input,15):

filtered signal

The peaks are vanishing, but the then I get these ugly steps, which I don't want.

like image 438
deSteini Avatar asked Dec 16 '15 18:12

deSteini


1 Answers

just use median filter! medfilt1(data,3) will do if this is a 1 pixel "cosmic" spike. If the peaks remain, increase the window size to 5 or more...

EDIT: so this is how op's data looks like:

enter image description here So we see that the data is not exactly uniform or ordered, and there are a lot of data points in the spikes unlike what one first understand from the question (guys please plot your data correctly!) The question is now, is the data in the spikes or on in the baseline?

like image 199
bla Avatar answered Nov 04 '22 14:11

bla