Study of the stability of Z-pinch implosions with different initial density profiles