Vector Normalization

Vector normalization of all spectra from hyperSpec object ad1, first calculating and subtracting mean spectrum (functions: apply and sweep and then dividing by variance. In order to compute variance rowSums function is used.

#vector normalization
#subtract mean
means4 <- apply (ad1, 1, mean)
ad1VN <- sweep(ad1, 1, means4, "-")
#divide by variance 
ad2VN <- ad1VN /sqrt(rowSums(ad1VN ^2))
Krzysztof Banas
Krzysztof Banas
Principal Research Fellow

I work as beam-line scientist at Singapore Synchrotron Light Source. My research interests include application of advanced statistical methods for hyperspectral data processing (dimension reduction, clustering and identification).

Related