MATLAB: Filter big data simulink or matlab

digital signal processingfilterMATLABMATLAB and Simulink Student SuiteSignal Processing Toolboxsimulinksmoothing

Hi I have the data in the image below :
and I tried smoothing and/or filtering, but had no luck to get a reasonable result. My goal is to get rid of all the spikes in the blue and make the plot similar to the red line much as possible. Any idea of the best method to that? The image below is for zoomed data
and the attached image is for the all plot:

Best Answer

hampel should get you started
plot(hampel(OutAIS.Data))
If you need something fancier, take a look at the diff of your signal:
plot(diff(OutAIS.Data),'.')
Your outliers seem to take a set of quantized values. That might help you replace the values with something more meaningful than a median.
Related Question