Function babalcore::pulse [−][src]
pub fn pulse(x: f64, alpha: f64) -> f64
Pulse func as defined here: https://en.wikipedia.org/wiki/Pulse_wave The global period is 1, the alpha value can be used to control the ratio between 1s and 0s.
use babalcore::*; assert_eq!(0.0, pulse(-0.125, 0.25)); assert_eq!(1.0, pulse(0.125, 0.25)); assert_eq!(0.0, pulse(0.375, 0.25)); assert_eq!(1.0, pulse(1.125, 0.25));