# hertzbel

1.1.1 • Public • Published

# hertzbel

## Installation

`npm add hertzbel` or `yarn add hertzbel`

## Introduction

`hertzbel` is a javascript library created to handle frequency related calculations and conversions, and a comprehensive of decibel calculations.

In telecommunications, frequencies and decibels go hand in hand. In the frequency domain, using decibel logarithmic formulas in place of Volts or Watts allows observers to see very high power levels and minuscule power levels on the same graph. To learn more about the usefulness of decibels visit wikipedia

The Hertzbel library was designed specifically to be used with spectrum analyzer data, though these calculations will assist in any relatable fields.

## Changelog

• `1.1.1`: Adjusted package to compile with Babel, now can be used in node
• `1.1.0`: added toFixed
• `1.0.5`: removed restriction to number of decimals
• `1.0.3`: added convertFrequency to Hertz
• `1.0.0`: initial launch of Hertzbel.

## Hertz Functions

Hertzbel has several frequency related calculations. Users may enter a string or a number as parameters into the functions.

#### Frequency Conversions

Translate any frequency from Hz, kHz, MHz, GHz, THz to another.

All frequency functions have an optional toDec which set the number of decimals (default is 8).

### Example: `toHz({string|number}, {toDec})`

```import {toHz} from "hertzbel";
toHz("100 kHz", 4);
-> "100000.0000 Hz"```

### Frequncy Conversion Functions

• `toHz({string|number}, {toDec})`
• `toKiloHz({string|number}, {toDec})`
• `toMegaGz({string|number}, {toDec})`
• `toGigaHz({string|number}, {toDec})`
• `toTeraHz({string|number}, {toDec})`
• `convertFrequency({string|number}, {UnitString}, {toDec})`

Summation function of two frequencies. Frequency inputs may be of any combination of units() (e.g., Hz + THz). The leading parameter will always determine the resulting units.

### `addFreq({string|number},{string|number})`

```import {addFreq} from "hertzbel";
-> "1100.00000000 kHz"```

### Frequency Subtraction

The function that calculates the difference between two frequencies. Inputs may be of any combination. The leading parameter will always determine the resulting units.

### `subFreq({string|number},{string|number}, {toDec})`

```import {subFreq} from "hertzbel";
subFreq("10 MHZ", "500 khz", 3);
-> "9.500 MHz"```

### Frequency Multiplcation

Multiplies a frequency against an integer.

### `multFreq({string|number}, {int}, {toDec})`

```import {multFreq} from "hertzbel";
multFreq("1.25ghz", 3, 9);
-> "3.750000000 GHz"```

### Frequency Division

Divides a frequency by an integer.

### `divFreq({string|number}, {int}, {toDec})`

```import {divFreq} from "hertzbel";
divFreq("3 GHz", 601, 9);
-> 0.004991681 GHz```

## Decibel Functions

Hertzbel's decibel functionality was created to relieve the difficult and time-consuming decibel calculations.

### From Watts to Decibel Conversion

Translates units from Watts to decibels. Users may enter a string or a number as parameters into the functions

### Example: `todBm({string|number})`

```import {todBm} from "hertzbel";
toDbm("4 mW");
-> "6 dBm"```

### Watt to Decibel Conversion Functions

• `toDbuW({string|number})`
• `toDbm({string|number})`
• `toDbw({string|number})`

### From Decibel to Watt Conversion

Translates values from decibels to Watts. Only strings may be used.

### Example: `toW({string})`

```import {toW} from "hertzbel";
toW("33 dBm");
-> "1.9952623149688795 W";```

### Decibel to Watt Conversion Functions

• `toUw({string})`
• `toMw({string})`
• `toW({string})`

Expected functionality in the future

• Volts to decibel
• Decibel subtraction
• Decibel to Decibel conversion
• Wavelength to frequency
• Frequency to wavelength
• Frequency bucket array

## Package Sidebar

### Install

`npm i hertzbel`

### Repository

github.com/Awmages/hertzbel

8

1.1.1

80 kB

15