Stochastic Processes (Spectral Representation)
Stochastic process generation based on the Spectral Representation Method which utilizes Power Spectral Density Functions. Correpsonding theory and literature can be found here Stochastic-Process-Generation.
Index
UncertaintyQuantification.SpectralRepresentation
Base.names
UncertaintyQuantification.dimensions
UncertaintyQuantification.evaluate
UncertaintyQuantification.sample
UncertaintyQuantification.to_physical_space!
UncertaintyQuantification.to_standard_normal_space!
Types and Spectral Representation functions
UncertaintyQuantification.SpectralRepresentation Method
SpectralRepresentation(psd::AbstractPowerSpectralDensity, time::AbstractVector{<:Real}, name::Symbol) -> SpectralRepresentation
Constructs a SpectralRepresentation
instance representing a stochastic process generated using the spectral representation method.
Arguments
psd::AbstractPowerSpectralDensity
: An instance of a power spectral density model.time::AbstractVector{<:Real}
: A vector of time points.name::Symbol
: A symbol representing the name of the process.
Returns
A SpectralRepresentation
instance with the given arguments (parameters).
Example
w = 0:0.1:10
S_0 = 1.0
ω_f = 2.0
ζ_f = 0.05
ω_g = 3.0
ζ_g = 0.1
psd = CloughPenzien(w, S_0, ω_f, ζ_f, ω_g, ζ_g)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
UncertaintyQuantification.sample Function
sample(sr::SpectralRepresentation, n::Integer=1) -> DataFrame
Generates samples of random phase angles for a given SpectralRepresentation
instance.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.n::Integer=1
: The number of samples to generate (default is 1).
Returns
A DataFrame
containing the generated samples of random phase angles.
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
samples = sample(sr, 5)
UncertaintyQuantification.evaluate Method
evaluate(sr::SpectralRepresentation, ϕ::AbstractVector{<:Real}) -> AbstractVector{<:Real}
Evaluates the stochastic process for a given SpectralRepresentation
instance and a vector of random phase angles.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.ϕ::AbstractVector{<:Real}
: A vector of random phase angles.
Returns
A vector of real numbers representing the evaluated stochastic process.
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
ϕ = rand(Uniform(0, 2π), length(psd.ω))
process_values = evaluate(sr, ϕ)
UncertaintyQuantification.to_standard_normal_space! Method
to_standard_normal_space!(sr::SpectralRepresentation, df::DataFrame) -> Nothing
Transforms the random phase angles in the given DataFrame
from a uniform distribution to a standard normal distribution.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.df::DataFrame
: ADataFrame
containing the random phase angles to be transformed.
Returns
Nothing. The DataFrame
is modified in place.
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
samples = sample(sr, 5)
to_standard_normal_space!(sr, samples)
UncertaintyQuantification.to_physical_space! Method
to_physical_space!(sr::SpectralRepresentation, df::DataFrame) -> Nothing
Transforms the random phase angles in the given DataFrame
from a standard normal distribution to a uniform distribution.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.df::DataFrame
: ADataFrame
containing the random phase angles to be transformed.
Returns
Nothing. The DataFrame
is modified in place.
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
samples = sample(sr, 5)
to_standard_normal_space!(sr, samples) # Transform to standard normal space
to_physical_space!(sr, samples) # Transform back to physical space
UncertaintyQuantification.dimensions Method
dimensions(sr::SpectralRepresentation) -> Int
Returns the number of dimensions (frequencies) in the given SpectralRepresentation
instance.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.
Returns
An integer representing the number of dimensions (frequencies).
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
num_dimensions = dimensions(sr)
Base.names Method
names(sr::SpectralRepresentation) -> Vector{Symbol}
Returns the names of the random phase angles for a given SpectralRepresentation
instance.
Arguments
sr::SpectralRepresentation
: An instance of theSpectralRepresentation
struct.
Returns
A vector of symbols representing the names of the random phase angles.
Example
w = 0:0.1:10
psd = CloughPenzien(w, 1.0, 2.0, 0.05, 3.0, 0.1)
t = 0:0.1:10
name = :process1
sr = SpectralRepresentation(psd, t, name)
phase_angle_names = names(sr)