I think one issue is that your initial data is not evenly sampled and thus filtering it directly is not going to do much good in regards to differentiating it.
I propose resampling of the data, filtering, differentiating and possibly filtering the resulting derivative again. For convenience I will use a custom function applyFilter
that is again reproduced at the end of this answer.
To resample the data I use Interpolation
and Table
interpolation = Interpolation[data];
(resampledData = Table[{x, interpolation@x}, {x, 0, 0.2, 0.0001}] //
applyFilter[MedianFilter[#, 30] &, MeanFilter[#, 10] &]) // ListPlot
together with applyFilter
to apply first a MedianFilter
to remove outliers and MeanFilter
to smooth the result. (You have to play around with the radius parameters for those filters depending on how fine you want to resample)
For differentiating the data Interpolation
is used again
interpolationDiff = Interpolation[resampledData]'; (* note the ' *)
which can be sampled
diffdata = Table[{x, interpolationDiff@x}, {x, 0, 0.2, 0.0001}]
and filtered again via
diffdata //applyFilter[MedianFilter[#, 10] &, MeanFilter[#, 10] &]
Instead of my chosen combination of MedianFilter
and MeanFilter
you can of course use any other linear/nonlinear filters, which might yield better results.
Definition for applyFilter
Clear@applyFilter;
applyFilter[filter_] := Function[data,
Module[{freq, value},
{freq, value} = Transpose@data;
Transpose[{freq, filter@value}]
]
];
applyFilter[filters__] := RightComposition @@ (applyFilter /@ {filters})
applyFilter[{filter_, n_}] := Nest[applyFilter[filter], # , n] &
"http://goo.gl/NaH6rM"
still work? $\endgroup$data = Normal[Databin["fHVr7FSi"]]
? $\endgroup$MedianFilter
to the x instead of y. $\endgroup$