simspec | R Documentation |
Simulate spectra from noise and a list of peaks.
simspec(n = 1L, npeaks = 50L,
x = rlnorm(npeaks, 7, 0.3), y = rlnorm(npeaks, 1, 0.9),
domain = c(0.9 * min(x), 1.1 * max(x)), size = 10000,
sdx = 1e-5, sdy = sdymult * log1p(y), sdymult = 0.2,
sdnoise = 0.1, resolution = 1000, fmax = 0.5,
baseline = 0, decay = 10, units = "relative")
simspec1(x, y, xout, peakwidths = NA_real_,
sdnoise = 0, resolution = 1000, fmax = 0.5)
n |
The number of spectra to simulate. |
npeaks |
The number of peaks to simulate. Not used if |
x , y |
The locations and values of the spectral peaks. |
xout , domain |
The output domain variable or its range. |
size |
The number of samples in each spectrum. |
sdx |
The standard deviation of the error in the observed locations of peaks, in units indicated by |
sdy |
The standard deviation(s) for the distributions of observed peak values on the log scale. |
sdymult |
A multiplier used to calculate |
sdnoise |
The standard deviation of the random noise in the spectra on the log scale. |
resolution |
The resolution as defined by |
fmax |
The fraction of the maximum peak height to use when defining the resolution. |
peakwidths |
The peak widths at |
baseline |
The maximum intensity of the baseline. Note that |
decay |
A constant used to calculate the exponential decay of the baseline. Larger values mean the baseline decays more sharply. |
units |
The units for |
Either a numeric vector of the same length as size
, giving the simulated spectrum, or a size
x n
matrix of simulated spectra.
Kylie A. Bemis
set.seed(1)
y <- simspec(2)
x <- attr(y, "domain")
plot(x, y[,1], type="l", ylim=c(-max(y), max(y)))
lines(x, -y[,2], col="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.