GaussAmp: [+] Generate Gaussian curves (GaussAmp).

View source: R/GaussAmp.R

GaussAmpR Documentation

[+] Generate Gaussian curves (GaussAmp).

Description

Generate Gaussian curves, according to the equation:

y = y_0+A\mathrm{e}\frac{-(x-c)^2}{2w^2}

Usage

GaussAmp(x, c = 0, w = 1, A = 1, y0 = 0)

Arguments

x

Values of an independent variable (a vector).

c

Center positions on x axis of each Gaussian curve (a scalar or a vector). Default is 0.

w

Width of each curve (a scalar or a vector). Default is 1.

A

Amplitude of each curve (a scalar or a vector). Default is 1.

y0

Offsets on y axis (a scalar or a vector). Default is 0.

Value

y - values of dependent variable of Gaussian curve.

Note

The number of curves is determined by maximal number of elements in any of 4 Gausian curve parameters' (c, w, A, y0) vector. Values in other parameters vectors are recycled as ilustrated in example 2 (see parameter "A").

Author(s)

Vilmantas Gegzna

See Also

Other curves inspHelper: unipeak()

Examples

library(hyperSpec)
library(spHelper)


# Example 1
x <- seq(-9.9, 10, 0.2)
y <- GaussAmp(x)

plot(x,y, type = "l", col = "green3"); grid()

# Example 2


# Make 7 lines
y <- GaussAmp(x, c = 1:7,A = c(1,2))

dim(y)
##[1]   7 100

Obj <- new("hyperSpec",spc = y,    wavelength = x,
         label = list (spc = "y", .wavelength = "x"))

plot(Obj, col = 1:nrow(Obj)); grid()


GegznaV/spHelper documentation built on April 16, 2023, 1:42 p.m.