Calculation of the spiked harmonic oscillators through a generalized pseudospectral method