Learn R Programming

SpecHelpers (version 0.2.7)

gaussCurve: Compute a Gaussian Curve

Description

Computes the y values describing a Gaussian distribution given a range of x values and parameters for mu, sigma, and area. A tail may be introduced into the curve to simulate the behavior of some chromatography peaks.

Usage

gaussCurve(x, area, mu, sigma, tail)

Arguments

x

A vector of x values which will be used to compute the corresponding y values. Use enough to give good resolution.

area

The area of the peak, in arbitrary units.

mu

The position of the peak. Must fall in the range of x, of course.

sigma

The standard deviation of the peak.

tail

A value describing any tailing desired. If NA, no tailing is applied.

Value

A vector of y values corresponding to the x values supplied.

See Also

lorentzCurve, makeSpec which uses this function to make either spectra or chromatograms.

Examples

Run this code
# NOT RUN {
### A pure Gaussian curve

myx <- seq(0, 100, length.out = 1000) # use lots of point for resolution
myy <- gaussCurve(x = myx, area = 1, mu = 40, sigma = 1.5, tail = NA)
plot(myx, myy, type = "l", main = "Pure Gaussian Curve")

### Now with tailing

myy2 <- gaussCurve(x = myx, area = 1, mu = 40, sigma = 1.5, tail = 0.1)
plot(myx, myy2, type = "l", main = "Gaussian Curve with Tailing")

# }

Run the code above in your browser using DataLab