data(NIRsoil)
opar <- par(no.readonly = TRUE)
par(mfrow = c(2, 2), mar = c(4, 4, 2, 2))
# plot of the 10 first spectra
matplot(as.numeric(colnames(NIRsoil$spc)),
t(NIRsoil$spc[1:10, ]),
type = "l",
xlab = "",
ylab = "Absorbance"
)
mtext("Raw spectra")
der <- gapDer(NIRsoil$spc, m = 1, w = 1, s = 1, delta.wav = 2)
matplot(as.numeric(colnames(der)),
t(der[1:10, ]),
type = "l",
xlab = "Wavelength /nm",
ylab = "gap derivative"
)
mtext("1st derivative spectra")
der <- gapDer(NIRsoil$spc, m = 1, w = 11, s = 1, delta.wav = 2)
matplot(as.numeric(colnames(der)), t(der[1:10, ]),
type = "l",
xlab = "Wavelength /nm",
ylab = "gap derivative"
)
mtext("1st derivative spectra with a window size = 11 nm")
der <- gapDer(NIRsoil$spc, m = 1, w = 11, s = 5, delta.wav = 2)
matplot(as.numeric(colnames(der)), t(der[1:10, ]),
type = "l",
xlab = "Wavelength /nm",
ylab = "gap derivative"
)
mtext("1st derivative spectra with: window size: 11 nm, smoothing: 5 nm")
par(opar)
Run the code above in your browser using DataLab