pub fn power_dbm(samples: &[Complex32], resistance: f32) -> f32 {
    // Units of Watt-ohms
    let avg = samples.iter().fold(0.0, |s, x| {
        s + x.norm_sqr()
    }) / samples.len() as f32;

    // Power in Watts.
    let power = avg / resistance;

    // Convert Watts to dBm.
    30.0 + 10.0 * power.log10()
}
/// Calculate the power (dBm) into the resistance (ohms) of the given samples.
Calculate the power (dBm) into the resistance (ohms) of the given samples.
Calculate the power ( dBm ) into the resistance ( ohms ) of the given samples .
pub fn power_dbm(samples: &[Complex32], resistance: f32) -> f32 {
    // Units of Watt-ohms
    let avg = samples.iter().fold(0.0, |s, x| {
        s + x.norm_sqr()
    }) / samples.len() as f32;
    // Power in Watts.
    let power = avg / resistance;
    // Convert Watts to dBm.
    30.0 + 10.0 * power.log10()
}
pub fn power_dbm ( samples : & [ Complex32 ] , resistance : f32 ) -> f32 { // Units of Watt-ohms let avg = samples . iter ( ) . fold ( 0.0 , | s , x | { s + x . norm_sqr ( ) } ) / samples . len ( ) as f32 ; // Power in Watts. let power = avg / resistance ; // Convert Watts to dBm. 30.0 + 10.0 * power . log10 ( ) }
Calculate the power (dBm) into the resistance (ohms) of the given samples.
Calculate the power ( dBm ) into the resistance ( ohms ) of the given samples .
samples
&[Complex32]
resistance
f32
samples
&[Complex32]
resistance
f32