1
$\begingroup$

I want to detect patterns (of an absorption spectrum which is nonperiodic) with Mathematica automaticly. I have found CorrelationFuncion but as far as I understand, it only does autocorrelation, not crosscorrelation. I also found ListCorrelate but it is similar to ListConvolve and doesn't truly detect patterns (see below). My testdata is:

spec1=
Table[(PDF[NormalDistribution[50,1],x]+PDF[NormalDistribution[53,1],x])
+0.8(PDF[NormalDistribution[60,1],x]+PDF[NormalDistribution[63,1],x])
+0.7PDF[NormalDistribution[40,0.3],x]+3PDF[NormalDistribution[30,1.5],x]+
RandomReal[{-0.03,0.0.3}],{x,0,100,0.1}];

and

spec2=
Table[PDF[NormalDistribution[4,1],x]+PDF[NormalDistribution[7,1],x]
+RandomReal[{-0.03,0.0.3}],{x,0,15,0.1}];

-

ListLinePlot[{spec1,spec2},PlotRange->Full]

testspectrum

If I use ListCorrelate, the big peak at x=30 is the maximum, although the pattern at x=50 and x=60 correlate much better.

ListLinePlot[ListCorrelate[spec1,spec2,{-1,1},0],PlotRange->Full]

Listcorrelate

I guess this is because Listcorrelate doesn't normalize. Is there any way of getting the maximum for x=50 (2nd max for x=60)?

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.