We can calculate the two-time correlation function $g(t) = \langle A(t)B\rangle$ of a system for a given list of times with the implemented function
tspan = [0:0.1:10;] g = timecorrelations.correlation(tspan, ρ0, H, J, A, B)
The calculation is performed by applying the operator
B to the initial density matrix
ρ0, which is then used as initial state for a time evolution according to a master equation with
timeevolution.master. The correlation
g is then just the expectation value of
A at every time-step.
If the list of times
tspan is omitted, the function automatically calculates the correlation until steady-state is reached.
Furthermore, we can calculate the spectrum by means of the Wiener-Khinchin theorem, i.e. as Fourier transform of the correlation function,
This can be done directly by using
timecorrelations.spectrum, which internally calculates the correlation function and the spectrum for a given list of frequencies. Alternatively, if you already calculated the correlation function you can calculate the spectrum and the corresponding frequencies with
ωlist = [-2π:0.1:2π;] spec = timecorrelations.spectrum(ωlist, H, J, A) ω, spec = timecorrelations.correlation2spectrum(tspan, g)
If the list of frequencies
ωlist is omitted, the correlation function is calculated up to steady-state and a list of the frequencies corresponding to the time it takes the system to reach steady-state is returned in addition to the spectrum.