Skip to main content

lib_jsl_dsp/discrete/windows/
boxcar.rs

1/// The boxcar window, also known as the rectangular window, is defined by a constant value of 1 across the entire window. It does not taper the edges and is equivalent to applying no window at all, which can lead to significant spectral leakage in Fourier analysis.
2pub fn boxcar(m: usize, _sym: bool) -> Vec<f64> {
3    vec![1.0; m]
4}
5
6#[cfg(test)]
7mod tests {
8    use super::*;
9    use crate::discrete::windows::test_support::assert_window;
10
11    #[test]
12    fn test_boxcar() {
13        assert_window(include_str!("../test_data/boxcar.csv"), boxcar(7, true));
14    }
15}