0
$\begingroup$

According a Poisson distribution, I generate a time trace made of random jumps between -1 and 1, so that the jumps are exponentially distributed. Then I compute the power spectrum of this signal, and I get something that resemble to a Lorentzian (see figure).

Can you help me in deriving an analytical formula for this power spectrum?

enter image description here

This is how I generate the trace (in python):

def make_random_n_trace(nelem=2e9, k=1., plots=0):
''' make a binary random trace in (-1,1) with exponentially distributed dwell times. nelem:num.of jumps. k:rate
'''
k = float(k)
dt = 1e-2/k 
ra = np.random.rand(nelem)
# exponentially distributed jumps:
t = np.log(1./ra)/k
tr = np.floor(t/dt)
x = []
s = 1
# create trace:
for ti in tr:
    x = np.append(x, s*np.ones(ti))
    s = -s
time = np.arange(len(x))*dt
spectrum_x = np.abs(np.fft.fft(x))**2
freq_x = np.fft.fftfreq(len(x), d=dt)
freq_x = freq_x[:len(spectrum_x)/2.]
spectrum_x = spectrum_x[:len(spectrum_x)/2.]
spectrum_x = spectrum_x/float(len(x)**2 *freq_x[1])
spectrum_x[1:] = 2*spectrum_x[1:]
if plots:
    plt.figure('kin3.make_random_n_trace')
    plt.subplot(211)
    plt.plot(time[:], x[:], '-o')
    plt.subplot(212)
    plt.loglog(freq_x, spectrum_x, '.')
return x, time
$\endgroup$
5
  • 1
    $\begingroup$ there is no way you can use your data (as is) for anything useful. First you have to clean it up: bin your data, smooth it out, etc. (BTW: it indeed looks Lorentzian to me; try to fit it to be sure) $\endgroup$ Dec 6, 2016 at 17:12
  • $\begingroup$ I'm not sure what you mean. I'd like to understand how the spectrum comes up, analytically. Later sure I can clean the spectrum to fit it with the analytical expression, for example. $\endgroup$
    – scrx2
    Dec 6, 2016 at 20:49
  • 2
    $\begingroup$ Would Signal Processing, Cross Validated or Computational Science be a better home for this question? $\endgroup$
    – Qmechanic
    Dec 6, 2016 at 22:21
  • $\begingroup$ I don't understand what you want. What does the computer simulation of the noise have to do with finding an analytic expression for the spectral density? $\endgroup$
    – DanielSank
    Dec 7, 2016 at 10:21
  • 1
    $\begingroup$ @DanielSank this the way I usually work: 0) vague idea of my experimental output, 1)computer simulation of a possible process, 2)analytical solution of 1 (i.e. ask around), 3)does 2 fit the data? if not, improve 1) and start cycle again. If yes, goto beer. $\endgroup$
    – scrx2
    Dec 7, 2016 at 10:35

1 Answer 1

3
$\begingroup$

I found out the following.

The signal $x(t)$ is called 'random telegraph', and its autocorrelation is $R(t)=exp(-2t/k)$ where $k$ is the rate of the Poisson process. Its power spectrum $S(\omega)$ can be written as the Fourier transform of the autocorrelation and it turns out that $S(\omega)=\sqrt{2/\pi}\frac{(2/k)}{1+(2/k)^2\omega^2}$. This expression fits quite well the points

tau = 2./k
plt.plot(freq_x, np.sqrt(2/np.pi)*tau/(1+tau**2*freq_x**2), '-', lw=2)

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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