Robochameleon  v1.0
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
pwr Class Reference

power description class More...

Public Member Functions

function pwr (in SNR, in P)
 Class constructor. More...
 
function plus_1elem (in obj1, in obj2)
 Add two power objects. More...
 
function plus (in obj1, in obj2)
 Add two power objects, with support for arrays of objects. More...
 
function minus (in obj1, in obj2)
 Subtract two power objects. More...
 
function mtimes (in in1, in in2)
 Multiply a power object by a scalar. More...
 
function times (in in1, in in2)
 Multiply an array of power objects by an array of scalars. More...
 
function mrdivide (in in1, in C)
 Divide a power object by a scalar. More...
 
function P (in obj, in varargin)
 Depreciated get for power.
 
function SNR (in obj, in varargin)
 get SNR
 
function Ptot (in obj, in varargin)
 get total power More...
 
function Ps (in obj, in varargin)
 get signal power More...
 
function Pn (in obj, in varargin)
 get noise power More...
 
function disp (in obj)
 display function
 

Static Public Member Functions

static function normpwr (in x, in varargin)
 normalize signal based on power More...
 
static function meanpwr (in x)
 Mean signal power and energy. More...
 
static function getOSNR (in sig, in varargin)
 get OSNR More...
 

Public Attributes

Property P_dBW
 Total power, dBW.
 
Property SNR_dB
 Signal-to-noise ratio, dB.
 

Static Private Member Functions

static function validpwr (in P)
 validate power More...
 
static function outputP (in P_dBW, in varargin)
 Parse format to get power. More...
 
static function outputSNR (in SNR_dB, in varargin)
 Parse format to get SNR. More...
 
static function inputP (in P)
 Parse format to set power. More...
 
static function inputSNR (in SNR)
 Parse format to set SNR. More...
 

Detailed Description

power description class

pwr describes the signal power and signal-to-noise ratio. It also has a number of useful power-related methods. Many parameters are specified as strings. None are case-sensitive.

Example

P1 = pwr(50, 5);
P2 = pwr(-50, {1, 'mw'});
P3 = P1+P2;

will create: P1, a power object describing a signal (50 dB SNR, 5dBm power) P2, a power object describing noise (-50dB SNR, 0 dBm power) then add them, returning P3, which should have about 5dB SNR, 6dBm total power

Author
Robert Borkowski
Version
1

Definition at line 27 of file pwr.m.

Constructor & Destructor Documentation

function pwr::pwr ( in  SNR,
in  P 
)

Class constructor.

Constructs an object of type pwr. Example:

P1 = pwr(50, 0);
P2 = pwr(50, {1, 'mw'});
P3 = pwr({1e5, 'lin'}, {1, 'mw'});

These statements are equivalent

Parameters
SNRif scalar, SNR in dB. Otherwise, cell array {value, unit}
Pif scalar, power in dBm. Otherwise, cell array {value, unit}
Return values
objobject of power type

Member Function Documentation

static function pwr::getOSNR ( in  sig,
in  varargin 
)
static

get OSNR

Parameters
sigA signal_inteface to retrieve the signal bandwidth.
varargin{1}String describing SNR unit {'dB' | 'lin'}. [Default: dB]
varargin{2}Bandwidth over which evaluate the OSNR [nm]. [Default: 0.1]
Return values
OSNRThe signal OSNR evaluated over the given bandwidth
static function pwr::inputP ( in  P)
staticprivate

Parse format to set power.

Convert power and specified format to dBW - default dBm

Parameters
Ppower in dBm as scalar or cell array with scalar + unit
Return values
P_dBpower in dBW
static function pwr::inputSNR ( in  SNR)
staticprivate

Parse format to set SNR.

Convert SNR and specified format to dB - default dB

Parameters
SNRSNR in dB as scalar or cell array with scalar + unit
Return values
SNR_dBSNR in dB
static function pwr::meanpwr ( in  x)
static

Mean signal power and energy.

Mean signal power and energy Example

[P,E] = pwr.meanpwr(X)
Parameters
xcomplex or real input signal
Return values
Psignal power
Esignal energy
Prangeminimum and maximum signal powers
Ppeakpeak signal power
function pwr::minus ( in  obj1,
in  obj2 
)

Subtract two power objects.

Subtract two power objects - do not do this, it doesn't make sense.

function pwr::mrdivide ( in  in1,
in  C 
)

Divide a power object by a scalar.

Divide a power object by a scalar. Useful for gain, loss.

Parameters
in1multiplicand (power object or scalar)
in2multiplicand (power object or scalar)
Return values
objobject of power type
function pwr::mtimes ( in  in1,
in  in2 
)

Multiply a power object by a scalar.

Multiply a power object by a scalar. Useful for gain, loss.

Parameters
in1multiplicand (power object or scalar)
in2multiplicand (power object or scalar)
Return values
objobject of power type
static function pwr::normpwr ( in  x,
in  varargin 
)
static

normalize signal based on power

Normalize signal based on calculated power

Example

s1= rand(10,2);
[y1, scfactor] = pwr.normpwr(s1, 'max', 1, 'linear');
[y2, scfactor2] = pwr.normpwr(s1, 'average', 1, 'linear');
[y3, scfactor3] = pwr.normpwr(s1);

y1 is normalized so that its peak power is 1 y2 is normalized so that its average power is 1 y3 = y2

Parameters
xsignal
typesignal property (power) to normalize {'average' | 'max'}
Ppower to normalize to (scalar)
unitunit power is specified in {'linear' | 'db' | 'dBm'}
Return values
ynormalized signal
scfactorscaling factor
static function pwr::outputP ( in  P_dBW,
in  varargin 
)
staticprivate

Parse format to get power.

Convert power in dBW to desired format

Parameters
P_dBWpower in dBW
vararginstring describing power unit {'dBm' | 'w' | 'mw' | 'uw' | 'dbw' | 'dbu'}
Return values
P_formatformatted power
static function pwr::outputSNR ( in  SNR_dB,
in  varargin 
)
staticprivate

Parse format to get SNR.

Convert SNR in dB to desired format

Parameters
SNR_dBSNR in dB
vararginstring describing SNR unit {'dB' | 'lin'}
Return values
SNR_formatformatted SNR
function pwr::plus ( in  obj1,
in  obj2 
)

Add two power objects, with support for arrays of objects.

Parameters
obj1addend power object
obj2addend power object
Return values
objobject of power type
function pwr::plus_1elem ( in  obj1,
in  obj2 
)

Add two power objects.

Parameters
obj1addend power object (single)
obj2addend power object (single)
Return values
objobject of power type
function pwr::Pn ( in  obj,
in  varargin 
)

get noise power

Returns noise power in desired format (default dBm)

Parameters
objpower object
vararginstring describing power unit {'dBm' | 'w' | 'mw' | 'uw' | 'dbw' | 'dbu'}
Return values
Pnformatted signal power
function pwr::Ps ( in  obj,
in  varargin 
)

get signal power

Returns signal power in desired format (default dBm)

Parameters
objpower object
vararginstring describing power unit {'dBm' | 'w' | 'mw' | 'uw' | 'dbw' | 'dbu'}
Return values
Psformatted signal power
function pwr::Ptot ( in  obj,
in  varargin 
)

get total power

Returns total (signal+noise) power in desired format (default dBm)

Parameters
objpower object
vararginstring describing power unit {'dBm' | 'w' | 'mw' | 'uw' | 'dbw' | 'dbu'}
Return values
Ptotformatted signal+noise power
function pwr::times ( in  in1,
in  in2 
)

Multiply an array of power objects by an array of scalars.

Multiply an array of power objects by an array of scalars.

Parameters
in1multiplicand (power object or scalar)
in2multiplicand (power object or scalar)
Return values
objobject of power type
static function pwr::validpwr ( in  P)
staticprivate

validate power

Check if power value is acceptable (real, scalar)


The documentation for this class was generated from the following file: