Matlab filter electical spikes in accelerometric data

前端 未结 5 1768
北海茫月
北海茫月 2020-12-03 20:22

I have a dataset of accelerometric data that is affected by electical spikes.

I\'m looking for a good method to filter out or reduce these spikes as need to calcula

5条回答
  •  情话喂你
    2020-12-03 20:40

    I find that for the specific problem of one-point spikes (which arises in CCD detectors when a cosmic ray discharges a single CCD cell during the exposure) the following algorithm works very well:

      N=length(y);
      for i=[3:1:N-2]
        # calculate the means of two nearest neighbours, and two next-nearest neighbours
        y1=(y(i-1)+y(i+1))/2;
        y2=(y(i-2)+y(i+2))/2;
        # if those two means are close, but the current point is far off, it's a spike
        if ( abs(y2-y(i)) > cutoff && abs(y1-y2) < cutoff)
           z(i)=y2;
        endif
      endfor
    

    Selecting the best strategy for a good cutoff selection is a separate issue; I tend to have it set to a fixed value based on the typical dark counts in the CCD. One can also use separate levels for what is "close" and what is "far off", like this:

        if ( abs(y2-y(i)) > cutoff_far && abs(y1-y2) < cutoff_close )
    

    One can also select a different criterion, like the difference between two means is X times smaller than the difference with the spike data:

        if ( abs(y2-y(i)) > 10*abs(y1-y2) )
    

    Peaks that are wider than a single-point spike survive this process unmolested.

    An example of de-spiked Raman spectrum using a CCD detector

提交回复
热议问题