lorentz | R Documentation |
The function takes in a vector "X" and returns a vector with the gaussian with the other parameters "amp" denoting A
, "x_0" denoting the mean x_0
, "gamm" denoting the HWHM or \gamma
and "probability" to toggle between statistical and probability distributions.
See Details
lorentz(X, amp, x_0, gamm, probability = F)
lorentz(X, x_0, gamm, probability = T)
lorentz(X, amp, x_0, gamm)
X |
The (numeric) vector which contain the |
amp |
Amplitude, |
gamm |
The HWHM, |
x_0 |
Describes the mean value, |
probability |
A single boolean value. |
The function returns the vector y_i
against the inputs x_i
as shown below.
\displaystyle y_i = \frac{1}{\pi\gamma}\large{\frac{A}{1 + (\frac{x_i - x_0}{\gamma})^2} \large}
For normalized probability curves, A = 1
, while x_0
and \gamma
are the center/mean of the distribution and the HWHM respectively
The returned value is always a numeric vector.
Chitran Ghosal
https://en.wikipedia.org/wiki/Cauchy_distribution
#####Build the variable X
X <- seq(-10, 10, by = 0.01)
####Build four lorentzians with increasing gamm and decreasing x_0
Y1 <- lorentz(X, x_0 = 1.5, gamm = 1.0, probability = T)
Y2 <- lorentz(X, x_0 = 1.0, gamm = 2.0, probability = T)
Y3 <- lorentz(X, x_0 = 0.5, gamm = 3.0, probability = T)
Y4 <- lorentz(X, x_0 = 0.0, gamm = 4.0, probability = T)
####Plot the lorentzians
plot(X, Y1, type = 'l')
lines(X, Y2, type = 'l', col='red')
lines(X, Y3, type = 'l', col='green')
lines(X, Y4, type = 'l', col='blue')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.