Home Reference Source
import Wavelength from 'js-electrical-engineering-equations'
const Wavelength = require('js-electrical-engineering-equations').Wavelength
public class | source

Wavelength

Wavelength represents a wavelength for a given frequency

Example:

let wavelength = new Wavelength('300');
const quarterWavelengthInInches = wavelength.toQuarterWavelength('in');
const quarterWavelengthInFeet = wavelength.toQuarterWavelength('f');
const quarterWavelengthInMeters = wavelength.toQuarterWavelength('m');
const quarterWavelengthInCentimeters = wavelength.toQuarterWavelength('cm');

Constructor Summary

Public Constructor
public

constructor(frequencyInMegahertz: number, precision: number)

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

setPrecision(precision: number)

Sets the precision for the Wavelength object.

public

Returns the full wavelength of the given frequency in centimeters as a float to the specified decimal precision.

public

Returns the full wavelength of the given frequency in feet as a float to the specified decimal precision.

public

Returns 5/8 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

public

Returns the full wavelength of the given frequency in meters as a float to the specified decimal precision.

public

Returns 1/2 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

public

Returns the full wavelength of the given frequency in inches as a float to the specified decimal precision.

public

Returns 1/4 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

public
public

Returns 3/4 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

Public Constructors

public constructor(frequencyInMegahertz: number, precision: number) source

Params:

NameTypeAttributeDescription
frequencyInMegahertz number

The given frequency for the wavelength.

precision number
  • optional
  • default: 4

The float precision for returned values.

Public Members

public frequencyInMegahertz: number source

public precision: number source

public valueInMeters: number source

Public Methods

public setPrecision(precision: number) source

Sets the precision for the Wavelength object.

Params:

NameTypeAttributeDescription
precision number

public toCentimeters(): number source

Returns the full wavelength of the given frequency in centimeters as a float to the specified decimal precision.

Return:

number

public toFeet(): number source

Returns the full wavelength of the given frequency in feet as a float to the specified decimal precision.

Return:

number

public toFiveEighthsWavelength(unit: string): number source

Returns 5/8 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

Params:

NameTypeAttributeDescription
unit string
  • optional
  • default: 'm'

use either 'm' for meters, 'cm' for centimeters, 'f' for feet, or 'in' for inches

Return:

number

public toFloat(): number source

Returns the full wavelength of the given frequency in meters as a float to the specified decimal precision.

Return:

number

public toHalfWavelength(unit: string): number source

Returns 1/2 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

Params:

NameTypeAttributeDescription
unit string
  • optional
  • default: 'm'

use either 'm' for meters, 'cm' for centimeters, 'f' for feet, or 'in' for inches

Return:

number

public toInches(): number source

Returns the full wavelength of the given frequency in inches as a float to the specified decimal precision.

Return:

number

public toQuarterWavelength(unit: string): number source

Returns 1/4 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

Params:

NameTypeAttributeDescription
unit string
  • optional
  • default: 'm'

use either 'm' for meters, 'cm' for centimeters, 'f' for feet, or 'in' for inches

Return:

number

public toString(): string source

Return:

string

The full wavelength of the given frequency as a string.

public toThreeQuartersWavelength(unit: string): number source

Returns 3/4 wavelength of the given frequency in the specified unit as a float to the specified decimal precision.

Params:

NameTypeAttributeDescription
unit string
  • optional
  • default: 'm'

use either 'm' for meters, 'cm' for centimeters, 'f' for feet, or 'in' for inches

Return:

number