lib_jsl_dsp/discrete/windows/blackman.rs
1use super::general_cosine::general_cosine;
2
3/// The Blackman window is a three-term general cosine window with coefficients `[0.42, 0.5, 0.08]`, giving lower side lobes than the Hann and Hamming windows at the cost of a wider main lobe.
4pub fn blackman(m: usize, sym: bool) -> Vec<f64> {
5 general_cosine(m, &[0.42, 0.5, 0.08], sym)
6}
7
8#[cfg(test)]
9mod tests {
10 use super::*;
11 use crate::discrete::windows::test_support::assert_window;
12
13 #[test]
14 fn test_blackman() {
15 assert_window(include_str!("../test_data/blackman.csv"), blackman(7, true));
16 }
17}