powerbw
Power bandwidth.
| Library |
|
Syntax
Function call
-
bw = powerbw(___,freqlims,r)— defines the frequency range in which the reference level is calculated. This syntax can include any combination of input arguments from the previous options, provided that the second input argument is eitherFs, orf. If the second input argument is passed as empty,powerbwassumes a normalized frequency. The function calculates the frequency difference between the points where the spectrum falls below the reference level byrdB or reaches the end point.
-
powerbw(___)— without output arguments, plots the SPM or power spectrum in the current graph window and annotates the bandwidth.
Arguments
Input arguments
# x — input signal
+
vector | the matrix
Details
An input signal specified as a vector or matrix. If x — vector, it is considered as a single channel. If x — the matrix, then the function powerbw calculates the power bandwidth independently for each column. x it must be finite-valued.
| Типы данных |
|
#
Fs —
sampling
rate
positive real scalar
Details
The sampling frequency, set as a positive real scalar. The sampling rate is the number of samples per unit of time. If time is measured in seconds, then the sampling frequency is indicated in hertz.
| Типы данных |
|
# pxx — spectral power density
+
vector | the matrix
Details
An estimate of the spectral power density (SPM), defined as a vector or matrix. If pxx — one-sided evaluation, then it must correspond to the actual signal. If pxx — the matrix, then powerbw calculates the bandwidth of each column pxx regardless.
The power spectral density should be expressed in linear units, not in decibels. Use the function db2pow to convert decibel values to power values.
| Типы данных |
|
# f — frequencies
+
vector
Details
Frequencies specified as a vector. If the first element is f equal to 0 Then powerbw assumes that the spectrum is a one-way spectrum of a real signal. In other words, the function doubles the power value in the zero frequency bin, aiming for the point 3 dB.
| Типы данных |
|
# sxx — power spectrum estimation
+
vector | the matrix
Details
An estimate of the power spectrum, specified as a vector or matrix. If sxx — the matrix, then powerbw calculates the bandwidth of each column sxx regardless.
The power spectrum should be expressed in linear units, not in decibels. Use the function db2pow to convert decibel values to power values.
| Типы данных |
|
# rbw — resolution band
+
positive scalar
Details
The resolution band is set as a positive scalar. The resolution band is the product of two quantities: the frequency resolution of the discrete Fourier transform and the equivalent noise band of the window used to calculate the SPM.
| Типы данных |
|
# freqlims — frequency limits
+
two-element vector
Details
Frequency limits set as a two-element vector of real values. If the argument is freqlims If set, the reference level will be the average power level in the reference band. If the argument is freqlims If not specified, the reference level will be the maximum power level in the spectrum. Meaning freqlims must be within the target band.
| Типы данных |
|
# r — power level drop
+
10*log10(2) (by default) | positive real scalar
Details
The power level drop, given as a positive real scalar, expressed in dB.
| Типы данных |
|
Name-value input arguments
# out — type of output data
+
:data (by default) | :plot
Details
Type of output data:
-
:data— the function returns data; -
:plot— the function returns a graph.
Examples
Bandwidth-limited signals
Details
We will generate a signal whose SPM resembles the frequency response of a bandpass FIR filter. 88-th order with normalized cutoff frequencies rad/countdown and rad/countdown.
import EngeeDSP.Functions: fir1
d = fir1(88, [0.25 0.45])
Calculate the occupied signal band at the level of 3 dB. We will specify as a reference level the average power in the range from rad/countdown to rad/countdown. Let’s build a schedule for the SPM.
import EngeeDSP.Functions: powerbw
powerbw(d, [], [0.2 0.6]*pi, 3, out=:plot)

We will output the bandwidth, its lower and upper limits, as well as the bandwidth power. Specifying the sampling rate it is equivalent to leaving it unidentified.
bw, flo, fhi, power = powerbw(d, 2π, [0.2, 0.6] * π)
println([" bw"; "flo"; "fhi"] .* " = " .* string.([bw; flo; fhi] / π) .* "π")
[" bw = 0.20047359178514887π", "flo = 0.24995529776303813π", "fhi = 0.450428889548187π"]
import EngeeDSP.Functions: bandpower
println("power = ", round((power/bandpower(d)*100)[1], digits=1), "% of total")
power = 96.9% of total
Add a second channel with normalized cutoff frequencies rad/countdown and rad/count and an amplitude of one tenth of the amplitude of the first channel.
d = [d fir1(88, [0.5 0.8])/10]
Let’s calculate the bandwidth of a two-channel signal at the level of 6 dB. We will specify the maximum power level of the spectrum as a reference level.
powerbw(d, [], [], 6, out=:plot)

Let’s output the bandwidth of each channel at the level of 6 dB, as well as the lower and upper limits.
bw, flo, fhi = powerbw(d, [], [], 6)
bds = [bw[1] bw[2]; flo[1] flo[2]; fhi[1] fhi[2]]
labels = [" bw", "flo", "fhi"]
for channel in 1:2
for i in 1:3
println(labels[i] * " (ch_$channel) = $(round(bds[i, channel] / π, digits=5))π")
end
end
bw (ch_1) = 0.19794π
flo (ch_1) = 0.25176π
fhi (ch_1) = 0.44971π
bw (ch_2) = 0.29418π
flo (ch_2) = 0.50271π
fhi (ch_2) = 0.79689π
Algorithms
To determine the bandwidth at the level of 3 dB function powerbw Calculates an estimate of the periodogram’s power spectrum using a rectangular window and uses the highest estimate as a reference level. Bandwidth is the frequency difference between points where the spectrum drops by at least 3 dB relative to the reference level. If the signal reaches one of its endpoints before descending to 3 dB, function powerbw uses this endpoint to calculate the difference.
The same bandwidth value per level 3 dB, bw, can be obtained from the signal x with sampling rate Fs in three ways.
Straight from the signal |
|
From the periodogram of the signal |
|
From the estimation of the spectral power (SPM Welch) of the signal |
|
Because powerbw It uses an intermediate representation to convert the input signal from the time domain to the frequency domain. The bandwidth of the returned power may vary depending on the signal conversion method, the number of DFT points, and the window size.
|