Recovery of a spectrum based on a compressive-sensing algorithm with weighted principal component analysis