Axial strain of ferrogels under cyclic magnetic fields