Analytical description of self-pulsing in optical bistability