pub struct PowerSpectralDensity {
pub frequencies: Vec<f64>,
pub power: Vec<f64>,
pub fs: f64,
pub window_len: usize,
}Expand description
Power Spectral Density estimate via Welch’s method.
The signal is divided into overlapping segments, each windowed with a Hann window and FFT’d, and the resulting periodograms are averaged.
Fields§
§frequencies: Vec<f64>Frequency bins (Hz).
power: Vec<f64>PSD values at each frequency bin.
fs: f64Sampling frequency (Hz).
window_len: usizeFFT window length used.
Implementations§
Source§impl PowerSpectralDensity
impl PowerSpectralDensity
Sourcepub fn welch(signal: &[f64], fs: f64, window_len: usize, overlap: f64) -> Self
pub fn welch(signal: &[f64], fs: f64, window_len: usize, overlap: f64) -> Self
Estimate PSD using Welch’s method.
fs is the sampling frequency.
window_len is the segment length (will be rounded to power-of-two).
overlap in [0, 1) fraction of the window to overlap.
Sourcepub fn freq_resolution(&self) -> f64
pub fn freq_resolution(&self) -> f64
Return the frequency resolution (Hz per bin).
Sourcepub fn dominant_frequency(&self) -> f64
pub fn dominant_frequency(&self) -> f64
Return the dominant frequency (frequency bin with maximum power).
Sourcepub fn total_power(&self) -> f64
pub fn total_power(&self) -> f64
Compute total power (integral of PSD over all frequencies).
Trait Implementations§
Source§impl Clone for PowerSpectralDensity
impl Clone for PowerSpectralDensity
Source§fn clone(&self) -> PowerSpectralDensity
fn clone(&self) -> PowerSpectralDensity
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PowerSpectralDensity
impl RefUnwindSafe for PowerSpectralDensity
impl Send for PowerSpectralDensity
impl Sync for PowerSpectralDensity
impl Unpin for PowerSpectralDensity
impl UnsafeUnpin for PowerSpectralDensity
impl UnwindSafe for PowerSpectralDensity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.