main content

measure power and ccdf of the power of voltage signal -凯发k8网页登录

measure power and ccdf of the power of voltage signal

since r2021a

description

the powermeter system object™ computes the power measurements of a voltage signal. when you set the computeccdf property to true, the object also calculates the complementary cumulative distribution function (ccdf) of the power of a voltage signal. the ccdf measurements that the object outputs are relative power and probability (in percentage). the power measurements include average power, peak power, and peak-to-average power ratio.

for more details on how the object computes the power measurements and the ccdf measurements, see .

to measure the power and the ccdf of the power of a voltage signal:

  1. create the powermeter object and set its properties.

  2. call the object with arguments, as if it were a function.

to learn more about how system objects work, see what are system objects?

creation

description

example

meter = powermeter returns a powermeter system object that computes power, peak-to-average power ratio (papr), and the complementary cumulative distribution function (ccdf) of the power of voltage signal. the ccdf helps find the probability that the instantaneous signal power exceeds a specified level above the average signal power.

meter = powermeter(len,overlap,name=value) sets the windowlength property to len and the overlaplength property to overlap.

to enable this syntax, set the computeccdf property to false.

example

meter = powermeter(name=value) returns a powermeter system object with each specified property set to the specified value. enclose each property name in quotes. you can use this syntax with the previous input argument.

properties

unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. objects lock when you call them, and the function unlocks them.

if a property is tunable, you can change its value at any time.

for more information on changing property values, see .

desired power measurement, specified as 'average power', 'peak power', 'peak-to-average power ratio' or 'all'.

for more details on how the object computes these measurements, see .

reference load used by the power meter to compute the power values in ohms, specified as a positive scalar.

tunable: yes

data types: single | double

specify whether to calculate ccdf as:

  • false –– the object does not calculate the ccdf measurements. the object computes the power measurements using the .

  • true –– the object computes the ccdf measurements.

    • all input samples since object creation or reset are used to compute statistics. the power measurements are stationary.

    • the windowlength and overlaplength properties become read-only and are set to inf and 0 respectively.

data types: logical

the x-axis range of the computed ccdf curves in db, specified as a positive scalar. the computed ccdf curves end at the maximum relative power, namely, peak-to-average power ratio (papr) of the signal, and start at papr - powerrange. for the ccdf capability of the powermeter object, relative power is the power in db by which the instantaneous signal power is above the average signal power.

dependencies

to enable this property, set the computeccdf property to true.

data types: single | double

the x-axis resolution of the computed ccdf curves in db, specified as a positive scalar.

dependencies

to enable this property, set the computeccdf property to true.

data types: single | double

sliding window length over which the measurement is computed, specified as a nonnegative integer.

dependencies

if the computeccdf property is true, then windowlength property is set to inf and is read-only.

data types: single | double

overlap length between sliding windows, specified as a nonnegative integer. the value of overlap length varies in the range [0, windowlength − 1]. if not specified, the overlap length is windowlength − 1.

dependencies

if the computeccdf property is true, then overlaplength property is set to 0 and is read-only.

data types: single | double

units of the measured power values, specified as 'dbm', 'dbw', or 'watts'.

usage

description

example

avgpwr = meter(x) computes the average power of the input signal x when the measurement property is set to 'average power'. each column of x is treated as an independent channel. the object computes the average power of each channel of the input signal independently.

peakpwr = meter(x) computes the peak power of the input signal x when the measurement property is set to 'peak power'. each column of x is treated as an independent channel. the object computes the peak power of each channel of the input signal independently.

papr = meter(x) computes the peak-to-average power ratio of the input signal x when the measurement property is set to 'peak-to-average power ratio'. each column of x is treated as an independent channel. the object computes the peak-to-average power ratio of each channel of the input signal independently.

example

[avgpwr,peakpwr,papr] = meter(x) computes the average power, peak power, and the peak-to-average power ratio of the input signal x when the measurement property is set to 'all'. each column of x is treated as an independent channel. the object computes the power measurements of each channel of the input signal independently.

input arguments

input voltage signal, specified as a vector or a matrix in volts. if x is a matrix, the object treats each column as an independent channel and computes the power measurements along each channel.

the object also accepts variable-size inputs. that is, once the object is locked, you can change the size of each input channel, but you cannot change the number of channels.

data types: single | double
complex number support: yes

output arguments

average power of the voltage signal, returned as a scalar, vector or a matrix, with the units determined by the powerunits property.

if you set the computeccdf property to false, the object computes the moving average power using the .

when you input a signal of size m-by-n to the object when the computeccdf property is set to false, the output has an upper bound size of ceil(m/hop size)-by-n. hop size is window length − overlap length. in other cases, the output has a size of m-by-n.

when you generate code from this object, the variable-size behavior of the output in the generated code depends on the input frame length and whether the size of the input signal is fixed or variable. for more details, see code generation.

if you set the computeccdf property to true, the object computes the stationary average power of the entire signal along each channel. in this case, the size of the output is 1-by-m, where m is the number of channels in the input signal.

for details on how the object computes the average power, see .

data types: single | double

peak power of the voltage signal, returned as a scalar, vector or a matrix, with the units determined by the powerunits property.

if you set the computeccdf property to false, the object computes the moving peak power using the .

when you input a signal of size m-by-n to the object when the computeccdf property is set to false, the output has an upper bound size of ceil(m/hop size)-by-n. hop size is window length − overlap length. in other cases, the output has a size of m-by-n.

when you generate code from this object, the variable-size behavior of the output in the generated code depends on the input frame length and whether the size of the input signal is fixed or variable. for more details, see code generation.

if you set the computeccdf property to true, the object computes the stationary peak power of the entire signal along each channel. in this case, the size of the output is 1-by-m, where m is the number of channels in the input signal.

for details on how the object computes the peak power, see .

data types: single | double

peak-to-average power ratio of the voltage signal, returned as a scalar, vector or a matrix.

if you set the computeccdf property to false, the object computes the moving peak-to-average power ratio using the .

when you input a signal of size m-by-n to the object when the computeccdf property is set to false, the output has an upper bound size of ceil(m/hop size)-by-n. hop size is window length − overlap length. in other cases, the output has a size of m-by-n.

when you generate code from this object, the variable-size behavior of the output in the generated code depends on the input frame length and whether the size of the input signal is fixed or variable. for more details, see code generation.

if you set the computeccdf property to true, the object computes the stationary peak-to-average power ratio of the entire signal along each channel. in this case, the size of the output is 1-by-m, where m is the number of channels in the input signal.

for details on how the object computes the peak-to-average power ratio, see .

data types: single | double

object functions

to use an object function, specify the system object as the first input argument. for example, to release system resources of a system object named obj, use this syntax:

release(obj)
plot ccdf curves
get coordinates of ccdf curves
use ccdf to find relative power for specified probability
use ccdf to find probability for specified relative power
run system object algorithm
release resources and allow changes to system object property values and input characteristics
reset internal states of system object

examples

compute the power measurements of a noisy sinusoidal signal using a power meter. these measurements include average power, peak power, and peak-to-average power ratio.

assume the maximum voltage of the signal to be 100 v. the instantaneous values of a sinusoidal waveform are given by the equation vi=vmax×sin(2πft), wherevi is the instantaneous value, vmax is the maximum voltage of the signal, and f is the frequency of the signal in hz.

initialization

the input signal is a sum of two sine waves with frequencies set to 1 khz and 10 khz, respectively. the frame length and the sampling frequency of the generated signal is 512 samples and 44.1 khz, respectively.

to measure the power in this signal, create a powermeter object. set measurement to 'all'. this setting enables the object to measure the average power, peak power, and peak-to-average power ratio. set the length of the sliding window to 16 samples and the reference load to 50 ohms. use this object to measure the power in dbm units. visualize the power measurements using the object.

framelength = 512;
fs = 44.1e3;
a = 100;
sine1 = dsp.sinewave(amplitude=a, ...
    frequency=1e3, ...
    samplerate=44.1e3, ...
    samplesperframe=framelength);
sine2 = dsp.sinewave(amplitude=a, ...
    frequency=10e3, ...
    samplerate=44.1e3, ...
    samplesperframe=framelength);
pm  = powermeter(16,measurement="all", ...
                     referenceload=50, ...
                     powerunits="dbm");
scope  = timescope(numinputports=4,samplerate=fs, ...
                   timespansource="property", ...
                   timespan=96, ...
                   ylabel="dbm", ...
                   ylimits=[-30 90]);
title = 'power measurements';
scope.channelnames = {'average power', ...
    'peak power','peak-to-average power ratio', ...
    'expected average power'};
scope.title = title;

compute the power measurements

add zero-mean white gaussian noise with a standard deviation of 0.001 to the sum of sine waves. vary the amplitude of the sine waves. measure the average power, peak power, and the peak-to-average power ratio of this noisy sinusoidal signal that has a varying amplitude. for details on how the object measures these power values, see . compare the measured values to the expected value of the average power.

the expected value of the average power p of the noisy sinusoidal signal is given by the following equation.

p=a122r a222r var(noise),

where,

  • a1 is the amplitude of the first sinusoidal signal.

  • a2 is the amplitude of the second sinusoidal signal.

  • r is the reference load in ohms.

in dbm, the expected power is computed using the following equation:

exppwrdbm=10log10(p) 30.

compare the expected value with the value computed by the object. all values are in dbm. these values match very closely. to verify, view the computed measurements using the timescope object.

vect = [1/8 1/2 1 2 1 1/2 1/8 1/16 1/32];
for index = 1:length(vect)
    v = vect(index);
    for i = 1:1000
        x = v*sine1() v*sine2() 0.001.*randn(framelength,1);
        p = (((v*a)^2)/100) (((v*a)^2)/100) (0.001)^2;
        exppwr = (10*log10(p) 30)*ones(framelength,1);
        [avgpwr,pkpwr,papr] = pm(x);
        scope(avgpwr,pkpwr,papr,exppwr);
    end
end

compute the ccdf measurements of a voltage signal. the ccdf measurements include the relative power and the probability. relative power is the amount of power in db by which the instantaneous signal power is above the average signal power. probability in percentage refers to the probability that the instantaneous signal power is above the average signal power by the relative power in db.

initialize a powermeter object and set the computeccdf property to true. the input to the object is a random voltage signal.

x = complex(rand(10000,1)-0.5,rand(10000,1)-0.5);
pm = powermeter(computeccdf=true)
pm = 
  powermeter with properties:
         measurement: 'average power'
       referenceload: 1
         computeccdf: true
          powerrange: 50
     powerresolution: 0.1000
    outputpowerunits: 'dbm'
   read-only properties:
        windowlength: inf
       overlaplength: 0

by default, the powermeter object computes the average power of the signal in dbm. the reference load is 1 ohm.

averagepower = pm(x) 
averagepower = 22.2189

using the function, find the probability that the instantaneous power of the signal is 3 db above the average power. the relative power in this case is 3 db.

prob = probability(pm,3)
prob = 7.6009

compute the relative power using the function. verify that the relative power for the computed probability is indeed 3 db.

relpwr = relativepower(pm,prob)
relpwr = 3.0000

using the function, plot the ccdf curve. set the reference curve to gaussian.

plotccdf(pm,gaussianreference=true)

figure contains an axes object. the axes object with title ccdf measurement, xlabel relative power (db above average power), ylabel probability (%) contains 2 objects of type line. these objects represent ccdf 1, gaussian reference.

algorithms

extended capabilities

version history

introduced in r2021a

see also

functions

  • | | |

objects

  • | | |

blocks

topics

  • (communications toolbox)
网站地图