Temporal Models

Time-domain functions for decay and oscillation fitting.

Exponential Decays

CurveFitModels.stretched_exponentialFunction
stretched_exponential(p, t)

Stretched exponential (Kohlrausch-Williams-Watts) decay function.

Arguments

  • p: Parameters [A, τ, β] or [A, τ, β, y₀]
    • A: Amplitude
    • τ: Characteristic time constant
    • β: Stretching exponent (0 < β ≤ 1)
    • y₀: Vertical offset (default: 0.0)
  • t: Independent variable (time)

\[\begin{aligned} f(t) = A \exp\left(-\left(\frac{t}{\tau}\right)^\beta\right) + y_0 \end{aligned}\]

When β = 1, this reduces to a single exponential decay. When β < 1, the decay is slower than exponential at long times.

https://en.wikipedia.org/wiki/Stretchedexponentialfunction

source
CurveFitModels.n_exponentialsFunction
n_exponentials(n::Int)

Generate a model function for a sum of n exponential decays.

Returns a function model(p, t) where:

  • p: Parameters [A₁, τ₁, A₂, τ₂, ..., Aₙ, τₙ, y₀]
    • Aᵢ: Amplitude of i-th exponential
    • τᵢ: Time constant of i-th exponential
    • y₀: Offset (final parameter)
  • t: Independent variable (time)

\[f(t) = \sum_{i=1}^{n} A_i e^{-t/\tau_i} + y_0\]

Example

bi_exp = n_exponentials(2)
p0 = [A1, τ1, A2, τ2, offset]
sol = solve(NonlinearCurveFitProblem(bi_exp, p0, t, y))
source

Oscillations

CurveFitModels.sineFunction
sine(p, t)

Sinusoidal function.

Arguments

  • p: Parameters [A, ω, ϕ] or [A, ω, ϕ, y₀]
    • A: Amplitude
    • ω: Angular frequency
    • ϕ: Phase
    • y₀: Vertical offset (default: 0.0)
  • t: Independent variable (time)

\[\begin{aligned} f(t) = A \sin(\omega t + \phi) + y_0 \end{aligned}\]

https://en.wikipedia.org/wiki/Sine_wave

source
CurveFitModels.damped_sineFunction
damped_sine(p, t)

Damped sine function (exponentially decaying sinusoid).

Arguments

  • p: Parameters [A, ω, ϕ, τ] or [A, ω, ϕ, τ, y₀]
    • A: Amplitude
    • ω: Angular frequency
    • ϕ: Phase
    • τ: Decay time constant
    • y₀: Vertical offset (default: 0.0)
  • t: Independent variable (time)

\[\begin{aligned} f(t) = A e^{-t/\tau} \sin(\omega t + \phi) + y_0 \end{aligned}\]

https://en.wikipedia.org/wiki/Damping

source