Immersed boundary approach to stability equations for a spatially periodic viscous flow