cdom_exponential: Fit an exponential model to CDOM data.

Description Usage Arguments Details Value Examples

View source: R/exponential.R

Description

Fit an exponential model to CDOM data.

Usage

1
cdom_exponential(wl, absorbance, wl0 = 350, startwl, endwl)

Arguments

wl

The wavelength vector.

absorbance

The absorbance vector.

wl0

The reference wavelength (ex.: 350).

startwl

The starting wavelength (ex.: 240).

endwl

The ending wavelength (ex.: 600).

Details

y = a0 * e^{(-S(x - λ_0))} + K

Value

A list containing:

params

A data frame with values of fitted parameters.

r2

R2 of the nls model.

data

A data frame with fitted (predicted) values of the model.

The function will return NULL if the model did not converged.

Examples

1
2
3
4
5
6
7
8
# Fit an exponential model using the reference wavelength 350 between 190 and 900 nm.

data(spectra)

fit <- cdom_exponential(spectra$wavelength, spectra$spc1, 350, 190, 900)

plot(spectra$wavelength, spectra$spc1)
lines(spectra$wavelength, fit$data$.fitted, col = "red")

PMassicotte/cdom documentation built on April 14, 2020, 4:38 p.m.