Immersed boundary simulation of the swing of a fish in fluid environment