dBm |
Power |
Units |
Volts RMS |
Volts Peak |
Volts Peak-to-Peak |
for($p = -20; $p <= 50; $p += 0.5) {
$watts = pow(10, $p/10) * 1e-3;
$voltsRMS = sqrt($watts * 50);
$voltsPeak = sqrt($watts * 2 * 50);
$voltsPeakToPeak = sqrt($watts * 8 * 50);
if($watts < 1e-3) {
$units = 'u';
$scale = 1e6;
} else if($watts < 1) {
$units = 'm';
$scale = 1e3;
} else {
$units = '';
$scale = 1;
}
# printf("%.1f dBm = %.3f %sW = %.4f Vrms %.4f Vpk %.4f Vpk-pk\n", $p, $watts*$scale, $units, $voltsRMS, $voltsPeak, $voltsPeakToPeak);
printf("%.1f | %.3f | %sW | %.4f | %.4f | %.4f |
\n", $p, $watts*$scale, $units, $voltsRMS, $voltsPeak, $voltsPeakToPeak);
}
?>