Calculation of the bound states of power-law and logarithmic potentials through a generalized pseudospectral method