SpectrumSmoothMarkov {Peaks} | R Documentation |
This function calculates smoothed spectrum from source spectrum based on Markov chain method.
SpectrumSmoothMarkov(y,window=3)
y |
numeric vector of source spectrum |
window |
width of averaging smoothing window |
The algorithm is based on discrete Markov chain, which has very simple invariant distribution:
U_2=frac{p_{1,2}}{p_{2,1}}U_1
U_3=frac{p_{2,3}}{p_{3,2}}U_2 U_1
...
U_n=frac{p_{n-1,n}}{p_{n,n-1}}U_{n-1} ... U_2 U_1
and U_1 being defined from the normalization condition:
sum_{i=1}^{n}U_i=1
n is the length of the smoothed spectrum.
The probability of the change of the peak position from channel i to the channel i+1 is :
p_{i,i pm 1}=A_i sum_{k=1}^{m}exp ( frac{y(i pm k)-y(i)}{y(i pm k)+y(i)})
where A_i is the normalization constant so that:
p_{i,i-1}+p_{i,i+1}=1
and m is a width of smoothing window.
Numeric vector with smoothed spectrum.
Miroslav Morhác
Z.K. Silagadze, A new algorithm for automatic photopeak searches. NIM A 376 (1996), 451.