Power Meter
Libraries:
DSP System Toolbox /
Statistics
Communications Toolbox /
Utility Blocks
Description
The Power Meter block computes the power measurements of a voltage signal. When you select the Compute CCDF parameter, the block also calculates the complementary cumulative distribution function (CCDF) of the power of a voltage signal. The CCDF measurements that the block outputs are relative power and probability (in percentage). The power measurements include average power, peak power, and peaktoaverage power ratio.
For more details on how the block computes the power measurements and the CCDF measurements, see Algorithms.
Ports
Input
Port_1 — Input signal
vector  matrix
Specify the input signal in volts as a vector or a matrix. If
x
is a matrix, the block treats each column as an independent
channel and computes the power measurement along each channel.
When the Allow arbitrary frame length for fixedsize input signals parameter appears and is not selected, and you input a fixedsize signal, the frame length must be a multiple of the hop size (window length − overlap length). In all other cases, the input frame length can be arbitrary.
The block accepts variablesize inputs (frame length changes during simulation). When you input a variablesize signal, the frame length of the signal can be arbitrary.
Data Types: single
 double
Complex Number Support: Yes
Rst — Reset port
scalar
Specify the boolean reset signal as a scalar. If the input on the
Rst port is true
, the block clears the
internal histograms and statistics before processing the current input. If the input
on the Rst port is false
, the block computes
the measurements from the start of the simulation or from the last reset.
Dependencies
To enable this port, select the Compute CCDF and Reset port parameters.
Data Types: Boolean
Output
Avg — Average power
scalar  vector  matrix
Average power of the voltage signal from the start of the simulation or from the last reset, returned as a scalar, vector, or a matrix. The block computes the average power along each channel in the units specified in the Output power units parameter. For details on how the block computes the average power, see Average Power.
If you clear the Compute CCDF parameter, the block computes the moving average power using the Sliding Window Method.
See this table for details on the output signal dimensions.
Input Signal  Input Dimensions  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Appears  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Does Not Appear 

Fixedsize signal  PbyM, where M is a multiple of the hop size (window length − overlap length)  (P/hop size)byM  PbyM 
Fixedsize signal  PbyM, where M is not a multiple of the hop size (window length − overlap length) 
If you do not select Allow arbitrary frame length for fixedsize input signals, the block errors.  PbyM 
Variablesize signal  PbyM  ceil (P/hop
size)byM  PbyM 
When the output has an upper bound size of
ceil
(P/hop size)byM,
during simulation, the size of the first dimension varies within this bound, while the
size of the second dimension remains constant.
If you select the Compute CCDF parameter, the block computes the stationary average power of the entire signal along each channel. In this case, the size of the output is 1byM, where M is the number of channels (columns) in the input signal.
Dependencies
To enable this port, set Measurement to
Average power
or All
.
Data Types: single
 double
Peak — Peak power
scalar  vector  matrix
Peak power of the voltage signal from the start of the simulation or from the last reset, returned as a scalar, vector, or a matrix. The block computes the peak power along each channel in the units specified in the Output power units parameter. For details on how the block computes the peak power, see Peak Power.
If you clear the Compute CCDF parameter, the block computes the moving peak power using the Sliding Window Method.
See this table for details on the output signal dimensions.
Input Signal  Input Dimensions  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Appears  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Does Not Appear 

Fixedsize signal  PbyM, where M is a multiple of the hop size (window length − overlap length)  (P/hop size)byM  PbyM 
Fixedsize signal  PbyM, where M is not a multiple of the hop size (window length − overlap length) 
If you do not select Allow arbitrary frame length for fixedsize input signals, the block errors.  PbyM 
Variablesize signal  PbyM  ceil (P/hop
size)byM  PbyM 
When the output has an upper bound size of
ceil
(P/hop size)byM,
during simulation, the size of the first dimension varies within this bound, while the
size of the second dimension remains constant.
If you select the Compute CCDF parameter, the block computes the stationary peak power of the entire signal along each channel. In this case, the size of the output is 1byM, where M is the number of channels (columns) in the input signal.
Dependencies
To enable this port, set Measurement to Peak
power
or All
.
Data Types: single
 double
PAPR — Peaktoaverage power ratio
scalar  vector  matrix
Ratio of the peak power to the average power (PAPR) of the voltage signal, returned as a scalar, vector, or a matrix. The block computes the peaktoaverage power ratio along each channel. For details on how the block computes this measurement, see PeaktoAverage Power Ratio.
If you clear the Compute CCDF parameter, the block computes the moving peaktoaverage power ratio using the Sliding Window Method.
See this table for details on the output signal dimensions.
Input Signal  Input Dimensions  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Appears  Output Dimensions When Allow arbitrary frame length for fixedsize input signals Does Not Appear 

Fixedsize signal  PbyM, where M is a multiple of the hop size (window length − overlap length)  (P/hop size)byM  PbyM 
Fixedsize signal  PbyM, where M is not a multiple of the hop size (window length − overlap length) 
If you do not select Allow arbitrary frame length for fixedsize input signals, the block errors.  PbyM 
Variablesize signal  PbyM  ceil (P/hop
size)byM  PbyM 
When the output has an upper bound size of
ceil
(P/hop size)byM,
during simulation, the size of the first dimension varies within this bound, while the
size of the second dimension remains constant.
If you select the Compute CCDF parameter, the block computes the stationary peaktoaverage power ratio of the entire signal along each channel. In this case, the size of the output is 1byM, where M is the number of channels (columns) in the input signal.
PAPR should be less that 100 dB to obtain accurate CCDF measurements. If PAPR is above 100 dB, the block shows only the highest 100 dB power levels.
Dependencies
To enable this port, set Measurement to
Peaktoaverage power ratio
or
All
.
Data Types: single
 double
RelPwr — Relative power
NbyM matrix
Relative power (dB above average power), returned as an NbyM matrix, where:
M is the number of channels (columns) in the input signal.
When you set CCDF output to
Relative power (dB above average power)
, N equals the length of the column vector that you specify in the Specify probability (%) for relative power output parameter.When you set CCDF output to
Relative power and probability (whole CCDF curve)
, N equalsceil
(Power range (dB)/Power resolution (dB)) + 1.
Relative power is the power in dB by which the instantaneous signal power is above the average signal power with a probability of Prob, expressed as a percentage. For details on how the block computes relative power, see Relative Power.
Dependencies
To enable this port, select the Compute CCDF parameter and
then set the CCDF output parameter to Relative
power (dB above average power)
or Relative power and
probability (whole CCDF curve)
.
Data Types: single
 double
Prob — Probability in percentage
NbyM matrix
Probability in percentage, returned as an NbyM matrix, where:
M is the number of channels (columns) in the input signal.
When you set CCDF output to
Probability (%)
, N equals the length of the column vector that you specify in the Specify relative power (dB) for probability output parameter.When you set CCDF output to
Relative power and probability (whole CCDF curve)
, N equalsceil
(Power range (dB)/Power resolution (dB)) + 1.
Prob(i)/100 is the probability that the instantaneous signal power of the j^{th} channel is above its average signal power by RelPwr(i,j) in dB.
Dependencies
To enable this port, select the Compute CCDF parameter and
then set the CCDF output parameter to Probability
(%)
or Relative power and probability (whole CCDF
curve)
.
Data Types: single
 double
Parameters
Measurement — Desired power measurement
Average power
(default)  Peak power
 Peaktoaverage power ratio
 All
Specify the desired power measurement as one of the following:
Average power
(default)Peak power
Peaktoaverage power ratio
All
For details on how the block computes these measurements, see Algorithms.
Reference load (ohms) — Reference load in ohms
1
(default)  positive scalar in ohms
Specify the reference load that the power meter uses to compute power values as a real, positive scalar in ohms.
Tunable: Yes
Data Types: single
 double
Output power units — Units of measured power values
dBm
(default)  dBW
 Watts
Specify the units of the measured power values as one of the following:
dBm
dBW
Watts
Compute CCDF — Enable CCDF computations
off (default)  on
Select the Compute CCDF parameter to enable the block to compute the CCDF of the power of voltage signals. CCDF measurements include the relative power and the probability (in percentage). 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.
These measurements provide a qualitative way to view the power distribution between the amplitude values of an input signal over time. The CCDF curves (plot of probability in percentage against relative power in dB) are useful indicators of the dynamic range of a signal.
When you select Compute CCDF:
The block uses all the input samples from the start of the simulation or from a reset signal on the Rst port to compute the statistics. The power measurements are stationary.
You can specify variablesize input signals.
When you clear Compute CCDF,
The block does not calculate the CCDF measurements and computes the power measurements using the Sliding Window Method.
The block accepts input signals of arbitrary frame length only when you select the Allow arbitrary frame length for fixedsize input signals parameter.
Window length — Window length
256
(default)  positive integer
Specify the window length over which the block computes the measurement as a positive integer.
Dependencies
To enable this parameter, clear the Compute CCDF check box.
When you select Compute CCDF, Window length
becomes Inf
.
Data Types: single
 double
Overlap length — Overlap length between windows
255
(default)  nonnegative integer
Specify the overlap length between sliding windows as a nonnegative integer. The value of overlap length varies in the range [0, Window length − 1].
Dependencies
To enable this parameter, clear the Compute CCDF check box.
When you select Compute CCDF, Overlap length
becomes 0
.
Data Types: single
 double
Allow arbitrary frame length for fixedsize input signals — Allow arbitrary frame length for fixedsize input signals
off (default)  on
Specify whether fixedsize input signals (whose size does not change during simulation) can have an arbitrary frame length, where the frame length does not have to be multiple of the hop size. Hop size is defined as Window length − Overlap length. The block uses this parameter setting only for fixedsize input signals and ignores this parameter if the input has a variablesize.
When the input signal is a variablesize signal, the signal can have arbitrary frame length, that is, the frame length does not have to be a multiple of the hop size.
For fixedsize input signals, if you:
Select the Allow arbitrary frame length for fixedsize input signals parameter, the frame length of the signal does not have to be a multiple of the hop size. If the input is not a multiple of the hop size, then the output is generally a variablesize signal. Therefore, to support arbitrary input size, the block must also support variablesize operations, which you can enable by selecting the Allow arbitrary frame length for fixedsize input signals parameter.
Clear the Allow arbitrary frame length for fixedsize input signals parameter, the input frame length must be a multiple of the hop size.
Dependencies
To enable this parameter, clear the Compute CCDF parameter.
Power range (dB) — Power range in dB
50
(default)  positive scalar
Specify the xaxis range of the CCDF curves as a positive scalar in dB. The CCDF curves end at the maximum relative power, namely, the PAPR of the signal, and start at PAPR − Power range (dB). In the CCDF capability of the Power Meter block, relative power is the power in dB by which the instantaneous signal power is above the average signal power.
Dependencies
To enable this parameter, select the Compute CCDF check box.
Data Types: single
 double
Power resolution (dB) — Power Resolution in dB
0.1
(default)  positive scalar
Specify the xaxis resolution of the CCDF curves as a positive scalar in dB.
Dependencies
To enable this parameter, select the Compute CCDF check box.
Data Types: single
 double
CCDF output — CCDF output
Relative power (dB above average
power)
(default)  Probability (%)
 Relative power and probability (whole CCDF
curve)
Specify the block to output:
RelPwr –– Relative power (dB above average power). This is the amount of power in dB by which the instantaneous signal power is above the average power.
Prob –– Probability in percentage. This is the probability that the instantaneous signal power is above the average signal power by the value of the relative power in dB.
Both the RelPwr and the Prob.
Dependencies
To enable this parameter, select the Compute CCDF check box.
Specify probability (%) for relative power output — Specify probability for relative power output
[10
;1
;0.1
;0.01
;0.001
;0.0001
] (default)  column vector
Specify the probability (in percentage) for the relative power output as a column vector. The length of this vector determines the number of rows in the relative power output at the RelPwr port.
Dependencies
To enable this parameter, select the Compute CCDF check box
and set the CCDF output parameter to Relative power
(dB above average power)
.
This also enables the RelPwr output port.
Data Types: single
 double
Specify relative power (dB) for probability output — Specify relative power for probability output
[0
;3
;6
;9
;12
] (default)  column vector
Specify the relative power (in dB) for the probability output as a column vector. The length of this vector determines the number of rows in the probability output at the Prob port.
Dependencies
To enable this parameter, select the Compute CCDF check box
and set the CCDF output parameter to Probability
(%)
.
This also enables the Prob output port.
Data Types: single
 double
Reset port — Enable reset port
off (default)  on
Select this parameter to enable the input port Rst that accepts
a boolean signal. If the value at the Rst port is
true
, then the block clears the internal histograms and statistics
before processing the current input.
Dependencies
To enable this parameter, select the Compute CCDF check box.
Simulate using — Type of simulation to run
Interpreted execution
(default)  Code generation
Specify the type of simulation to run. You can set this parameter to:
Interpreted execution
–– Simulate model using the MATLAB^{®} interpreter. This option shortens startup time.Code generation
–– Simulate model using generated C code. The first time you run a simulation, Simulink^{®} generates C code for the block. The C code is reused for subsequent simulations as long as the model does not change. This option requires additional startup time but provides faster subsequent simulations.
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

Algorithms
Sliding Window Method
When you do not configure the power meter to compute the CCDF measurements, the power meter computes the moving power measurements using the sliding window method.
In the sliding window method, the block computes the power measurement over a finite duration of the signal. The window length defines the length of the data over which the algorithm computes the power value. The window moves as new data comes in. The output for each input sample is the measurement over the current sample and Len – 1 previous samples. Len is the length of the sliding window in samples. To compute the first output sample, the algorithm waits until it receives the hop size number of input samples. Hop size is defined as window length – overlap length. Remaining samples in the window are considered to be zero. As an example, if the window length is 5 and the overlap length is 2, then the algorithm waits until it receives 3 samples of input to compute the first sample of the output. After generating the first output, it generates the subsequent output samples for every hop size number of input samples.
For a more detailed example, see Sliding Window Method.
If the window is large, the power that the block computes is closer to the stationary power of the data. For data that does not change rapidly, use a long window to get a smoother measurement. For data that changes fast, use a smaller window.
When you configure the power meter to compute the CCDF measurements, the algorithm
computes the stationary power of the data. It sets the window length to
Inf
and the overlap length to 0
, making both
the parameters readonly.
Average Power
When you do not configure the power meter to compute the CCDF measurements, the power meter computes the moving average power of the voltage signal across each channel using the Sliding Window Method. When you do configure the power meter to compute the CCDF measurements, the power meter computes the stationary average power of the voltage signal across each channel.
These equations give the average power in dBm
,
dBW
, and in Watts
units.
$$AvgPowe{r}_{dBm}=10{\mathrm{log}}_{10}\left(Avg\left({\leftx\right}^{2}\right)/R\right)+30$$
$$AvgPowe{r}_{dBW}=10{\mathrm{log}}_{10}\left(Avg\left({\leftx\right}^{2}\right)/R\right)$$
$$AvgPowe{r}_{Watts}=Avg\left({\leftx\right}^{2}\right)/R$$
where,
x is the input voltage signal.
R is the reference load (in ohms) that the block uses to compute the power value.
Avg
represents the moving average power when the power meter does not compute the CCDF measurements. Thepowermeter
object in MATLAB uses thedsp.MovingAverage
object and the Power Meter block in Simulink uses the Moving Average block.When the power meter does compute the CCDF measurements,
Avg
represents the stationary average power across each channel.
Peak Power
When you do not configure the power meter to compute the CCDF measurements, the power meter computes the moving peak power of the voltage signal across each channel using the Sliding Window Method. When you do configure the power meter to compute the CCDF measurements, the power meter computes the stationary peak power of the voltage signal across each channel.
These equations give the peak power in dBm
, dBW
,
and in Watts
units.
$$PeakPowe{r}_{dBm}=10{\mathrm{log}}_{10}\left(Max\left({\leftx\right}^{2}\right)/R\right)+30$$
$$PeakPowe{r}_{dBW}=10{\mathrm{log}}_{10}\left(Max\left({\leftx\right}^{2}\right)/R\right)$$
$$PeakPowe{r}_{Watts}=Max\left({\leftx\right}^{2}\right)/R$$
where,
x is the input voltage signal.
R is the reference load (in ohms) that the block uses to compute the power value.
Max
represents the moving peak power when the power meter does not compute the CCDF measurements. Thepowermeter
object in MATLAB uses thedsp.MovingMaximum
object and the Power Meter block in Simulink uses the Moving Maximum block.When the power meter does compute the CCDF measurements,
Max
represents the stationary peak power across each channel.
PeaktoAverage Power Ratio
When you do not configure the power meter to compute the CCDF measurements, the power meter computes the moving peaktoaverage power ratio of the voltage signal across each channel using the Sliding Window Method. When you do configure the power meter to compute the CCDF measurements, the power meter computes the stationary peaktoaverage power ratio of the voltage signal across each channel.
These equations give the peaktoaverage power ratio in dBm
,
dBW
, and in Watts
units.
$$pkAvgPw{r}_{dBm}=10{\mathrm{log}}_{10}\left(Max\left({\leftx\right}^{2}\right)/Avg\left({\leftx\right}^{2}\right)\right)$$
$$pkAvgPw{r}_{dBW}=10{\mathrm{log}}_{10}\left(Max\left({\leftx\right}^{2}\right)/Avg\left({\leftx\right}^{2}\right)\right)$$
$$pkAvgPw{r}_{Watts}=Max\left({\leftx\right}^{2}\right)/Avg\left({\leftx\right}^{2}\right)$$
where,
x is the input voltage signal.
Avg
represents the moving average power when the power meter does not compute the CCDF measurements. Thepowermeter
object in MATLAB uses thedsp.MovingAverage
object and the Power Meter block in Simulink uses the Moving Average block.When the power meter does compute the CCDF measurements,
Avg
represents the stationary average power across each channel.Max
represents the moving peak power when the power meter does not compute the CCDF measurements. Thepowermeter
object in MATLAB uses thedsp.MovingMaximum
object and the Power Meter block in Simulink uses the Moving Maximum block.When the power meter does compute the CCDF measurements,
Max
represents the stationary peak power across each channel.
Relative Power
The power meter computes the relative power only when you configure the algorithm to compute the CCDF measurements. The algorithm uses a window of infinite duration to compute the relative power.
Relative power is the amount of power in dB by which the instantaneous signal power is above the average signal power. The block calculates the relative power using these equations:
If output power is in dBm
,
$$relPower=10{\mathrm{log}}_{10}\left({\leftx\right}^{2}/R\right)+30AvgPowe{r}_{dBm}$$
If output power is in dBW
,
$$relPower=10{\mathrm{log}}_{10}\left({\leftx\right}^{2}/R\right)AvgPowe{r}_{dBW}$$
If output power is in Watts
,
$$relPower=\left({\leftx\right}^{2}/R\right)AvgPowe{r}_{Watts}$$
where,
x is the input voltage signal.
R is the reference load (in ohms) that the block uses to compute the power value.
x^{2}/R is the instantaneous signal power in Watts.
AvgPower is the average power of the voltage signal. For more details on how the algorithm computes this measurement, see Average Power.
Probability
The power meter computes the probability only when you configure the algorithm to compute the CCDF measurements. Probability in percentage refers to the probability that the instantaneous signal power is above the average signal power by the relative power in dB.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2021aR2024a: Change in the default value of Simulate using parameter
The default value of the Simulate using parameter is now
Interpreted execution
. With this change, the block uses the
MATLAB interpreter for simulation by default.
R2022b: New Overlap length parameter
Starting in R2022b, when the block is not computing the CCDF measurements, you can specify the overlap length between sliding windows using the Overlap length parameter.
R2022b: Support for arbitrary input frame length
Power Meter block supports input signals with arbitrary frame lengths when the:
Input signal is a fixedsize signal (frame length does not change during simulation) and you select the Allow arbitrary frame length for fixedsize input signals parameter (if enabled).
Input signal is a variablesize signal (frame length changes during simulation).
When this block supports an arbitrary frame length input signal, the input frame length does not have to be a multiple of the hop size.
See Also
Objects
Blocks
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissezla dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)