I have a series data


We can show it

ListPlot[data, PlotRange -> All]

Mathematica graphics

I put a singular value in position $20$ and $21$.As I know,wavelet analysis can detect it,but I don't know how to do it.


Of course expected more professionnel answer,I just dig in documentation

Firstly,plots wavelet transform coefficients

dwd = DiscreteWaveletTransform[data];

Mathematica graphics

Select that basis index with minimal energy

{basisIndex} = Keys[MinimalBy[dwd["EnergyFraction"], Last]]

{{0, 1}}

Ugly to extract that x-value.

 Cases[basisIndex /. dwd["ListPlot"], a_Line :> a, Infinity][[1,1]], Abs@*Last]

{{20.1, 1.00915}}


Simple way not using wavelet

Position[data - MedianFilter[data, 3], x_ /; x > 1]

{{20}, {21}}

  • $\begingroup$ Thanks very much,but I have to say,it hard to find that threshold form those difference value $\endgroup$ – yode Sep 18 '17 at 12:22
  • $\begingroup$ If you don't like picking an amplitude for the threshold, then just pick the Position of the largest (absolute) value of data-MedianFilter. $\endgroup$ – bill s Sep 18 '17 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.