EN
In the present contribution, the attenuation function S(t) for an ensemble of spins in a magnetic-field gradient is calculated through an accumulation of the phase shifts in the rotating frame resulting from the changes of the particle displacements. The found S(t) is applicable for any kind of the stochastic motion of spins, including their non-Markovian dynamics with memory. Depending on the considered system, both the classical expressions valid for normal diffusion at long times and new formulae for the short-time Brownian motion can be obtained. Our method is also applicable to the NMR pulse sequences based on the refocusing principle. This is demonstrated by describing the spin echo experiment developed by Hahn.