Skip to main content

Maximum length binary sequences and spectral power distribution of periodic signals

Abstract

The maximum length binary sequence (MLBS) is widely used as a broadband pseudo-random noise excitation signal, for example, for system identification. Although its properties have been known for decades, misleading or inaccurate statements can be found in many references. For example, it is sometimes stated that the spectrum of the MLBS is white, whereas in other references a sinc behavior is stated. In this paper, we therefore analyze the MLBS properties based on precise definitions for the given context (time-discrete vs. time-continuous, periodic vs. non-periodic, etc.), especially with respect to Fourier analysis. Another difficulty arises from the fact that in the literature the mathematical definitions are often simplified by means of normalizations which makes the physical interpretation difficult. Therefore, special emphasis is put on scaling factors which allow such a physical interpretation.

1 Introduction

Maximum length binary sequences (MLBS) are a special form of pseudo-random noise that can be created from linear feedback shift registers (LFSR) [1]. The theory of MLBSs has been developed decades ago [1], and while there are many different applications of them [2,3,4,5], they are in particular useful for system identification purposes [6,7,8] as easy-to-implement broadband excitation signals with various applications [9,10,11,12].

Since the estimation of spectra and spectral densities is a well-known signal processing technique [13], their application to MLBSs should be straightforward. Yet, there are many discrepancies and inconsistencies in the literature concerning the exact properties of MLBSs like in particular their spectrum and their power spectral density (which are unfortunately often used synonymously), and how these properties are affected by the basic time steps of the sequence and the sampling time, to name only a few aspects. We address these issues by giving clear and consistent definitions with well-defined ranges of validity.

The importance of choosing appropriate parameters for the MLBS excitation signal (according to the expected dynamics of the system that is to be identified) is highlighted, for example, by the occurrence of a system identification error when a PI controller is used [14] that can be mitigated to some extent if the MLBS’s order is sufficiently high [14].

In practice, one typically doesn’t use the “pure” MLBS (which is a discrete series of numbers) but rather a continuous-time realization (typically generated by means of a zero-order hold (ZOH) process). However, when measurements are performed (e.g., with a digital sampling oscilloscope), these time-continuous signals are converted back to discrete-time data by means of sampling. In our contribution, we will therefore distinguish as precisely as possible between the base MLBS, its time-continuous representation, and a sampled MLBS signal and explicitly elaborate the links between them.

For the characterization of these MLBS signals, Fourier analysis is of course an important technique as for other signals as well, e.g., via a fast Fourier transform (FFT) [15]. However, since not only time-discrete and time-continuous signals have to be distinguished but also periodic and non-periodic signals (and even deterministic vs. stochastic signals) [16, 17], statements concerning the spectrum of an MLBS signal have to be handled with care. Last but not least, many references work with formulas that are normalized so that a physically meaningful interpretation is difficult. Therefore, we will provide definitions of the different signal processing steps (i.e., transformation into the frequency domain, autocorrelation function, and power spectral density) with special focus on the relevant scaling factors. Afterward, an application of these definitions to the different MLBS representations leads us to transparent interpretations of the results. Specifically, we will discuss the influence of different parameters such as the number of bits of the base MLBS, the base time or the observation time.

The paper is organized as follows:

Section 2 gives detailed definitions of terms and formulas to create a solid mathematical basis and lists the main properties of MLBSs that are of major importance for the scope of this paper.

In Sect. 3, the discrete Fourier transform (DFT) and the power spectral density (PSD) of MLBSs are calculated, with clear reference to scaling factors that ensure the physical interpretability of these results.

Finally, in Sect. 4, the results obtained for the pure discrete-time sequence are extended for a continuous-time realization of an MLBS that is sampled afterward. An example highlights the pitfalls one might encounter designing an MLBS for system identification purposes and how this work helps to circumvent them. The procedures outlined in this last section also allow for a description of the impacts of hardware limitations (finite rise times of the signal-generating devices or time-step restrictions of their internal clocks) on the PSD of the signal.

2 Definitions and properties of an MLBS

Figure 1 shows an example for a 4-bit linear feedback shift register based on [2].

Fig. 1
figure 1

Example for a 4-bit linear feedback shift register

Each bit \(a^i_k\) can hold the values 0 or 1: \(a^i_k\in \{0,1\}\subset \mathbb {R}\). The upper index \(i\in \{0,1,...,n-1\}\), where n is the total number of bits in the register, denotes the position, and the lower index \(k\in \mathbb {N}_0\) denotes the time step for the time \(t = kT_{\textrm{base}}\) with the so-called base time \(T_{\textrm{base}}\in \mathbb {R}^+\).

The state of the whole shift register at time step k is given by the n-tuple \(\left( a^i_k\right) = \left( a^{n-1}_k,a^{n-2}_k,...,a^1_k,a^0_k\right)\).

After each time step, the values of all bits are shifted one tab to the right, \(a^i_{k+1} = a^{i+1}_k\), for \(i\in \{0,1,...,n-2\}\). Due to the feedback loop, the value of the highest bit \(a^{n-1}_{k+1}\) at time step \(k+1\) is calculated as a sum (modulo 2) of the values of some bits at the previous time step k. Which bits are fed back is called the taps and is a crucial property of the shift register that will be discussed later. In the example shown in Fig. 1 with \(n=4\), the bits at position 0 and 1 are fed back via an XOR gate, performing the modulo 2 addition. Thus,

$$\begin{aligned} a^3_{k+1} = a^1_k \oplus a^0_k. \end{aligned}$$
(1)

The output of the shift register at time step k is the value of \(a^0_k,\) and the total output is represented by the sequence \(\left\{ a^0_k\right\} =\left\{ a^0_0, a^0_1, a^0_2,..., a^0_{p-1}, a^0_0, a^0_1,...\right\}\).

A shift register with a length of n bits represents one of \(2^n\) different states \(\left( a^i_k\right)\) at each time step k. As proven by Golomb [1], the succession of these states is periodic with period \(0<p\le 2^n-1\), since every state is determined by the previous state and there are only a finite number of different states: \(a^i_{k+p}=a^i_k\). The state all zeroes produces a trivial output sequence. (This state will be maintained infinitely.) The term “maximum length” denotes a feedback shift register whose output sequence periodically produces all other \(2^n-1\) states. The output has the maximum period \(p=2^n-1\), so whatever the initial state is (except all zeroes), the register will eventually hold every possible initial state. It is therefore sufficient to only consider the initial state all ones and—except explicitly stated otherwise—this will be assumed to be the standard initial state throughout this work: \(\left( a^i_0\right) =(1,1,...,1)\).

Since the history of every bit \(a^i\) with \(i\in \{0,1,...,n-2\}\) is identical to the history of the previous bit \(a^{i+1}\) with a delay of one time step, for \(k\ge n-1\) every bit’s state can be traced back to a previous state of \(a^{n-1}\). This allows for a generalization of Eq. (1) in the form of a linear recurrence [1]:

$$\begin{aligned} a^{n-1}_{k+1}&= c_{n-1}a^{n-1}_{k} \oplus c_{n-2}a^{n-2}_{k} \oplus ... \oplus c_{0}a^{0}_{k}\\&= c_{n-1}a^{n-1}_{k} \oplus c_{n-2}a^{n-1}_{k-1} \oplus ... \oplus c_{0}a^{1}_{k-1}\nonumber \\&\vdots \nonumber \\&= c_{n-1}a^{n-1}_{k} \oplus c_{n-2}a^{n-1}_{k-1} \oplus ... \oplus c_{0}a^{n-1}_{k-(n-1)}\nonumber \end{aligned}$$
(2)

Figure 2 shows the general structure of the LFSR according to Eq. (2).

Fig. 2
figure 2

General structure of a LFSR

The taps are thus given by the tuple \((c_{n-1},...,c_1,c_0)\) with \(c_j\in \{0,1\}\subset \mathbb {R}\). For the example in Fig. 1, this tuple is \((c_3,c_2,c_1,c_0)=(0,0,1,1)\) and its characteristic polynomial [18] is \(P(x) = x^4+x+1\). A list of suitable taps that produce LFSRs with maximum period length for a given length n can be found in [19].

In the following, we assume that the taps have been chosen in a way such that an MLBS is obtained.

An MLBS in the sense of this work is then created by mapping the output of the shift register to \(-1\) and \(+1\), respectively, via \(b_k=-e^{j\pi a^0_k}\) with the imaginary unit j or simply \(b_k = 2a^0_k-1\). Note that the superscript 0 of the bit is omitted for the MLBS. The MLBS is represented by the sequence \(\{b_k\}=\{b_0, b_1, b_2,..., b_{p-1}, b_0, b_1,...\}\).

In the literature, the mapping to \(-1\) and \(+1\) is sometimes reversed [20, 21], or even both versions of the mapping are used [1].

Figure 3 shows two examples for a 4-bit and a 7-bit MLBS.

Fig. 3
figure 3

Examples of a 4-bit and a 7-bit MLBS, each with initial state all ones

Being deterministic, an MLBS cannot be truly random but it has some “randomness characteristics” as postulated by Golomb [1], accounting for the name pseudo-random noise sequence:

  1. R-1

    In every period, the disparity between the number of \(+1\)s and the number of \(-1\)s does not exceed 1.

  2. R-2

    In every period, half the runs (i.e., a sequence of identical values) have length one, one-fourth have length two, and so on. Notably, there are one run of length n of \(+1\)s and one run of length \(n-1\) of \(-1\)s.

  3. R-3

    The autocorrelation function \(R_{bb}[l]\) (definition: Eq. (14)) has only two values:

    $$\begin{aligned} R_{bb}[l] = \frac{1}{p}\sum _{k=0}^{p-1} b_{k+l} b_k ={\left\{ \begin{array}{ll} 1 &{} \text {for}~l=0 \mod p\\ -\frac{1}{p} &{} \text {else} \end{array}\right. } \end{aligned}$$
    (3)

The property R-3 is responsible for the broad spectrum of an MLBS, as will be discussed later.

Further properties, especially considering cross-correlations, are given in [20].

The autocorrelation function \(R_{bb}[l]\) calculated with Eq. (3) is shown in Fig. 4 for a 4-bit and a 7-bit MLBS, respectively.

Fig. 4
figure 4

Autocorrelation function \(R_{bb}[l]\) of a 4-bit MLBS (top) and a 7-bit MLBS (bottom)

Since the signal is periodic, so is its autocorrelation function, and the distinct peaks occur at 0 and at multiples of the period p. The scaling factor 1/p in Eq. (3) ensures that the peaks have unit height and the negative “floor” decreases to zero as the number of bits increases. Thus, even for a lag of only one single time step, the shifted signal looks almost completely uncorrelated to the original one. That means, although an MLBS is deterministic its autocorrelation function approximates a pure random process.

It is important to note that the MLBS as a sequence \(\{b_k\}\) exists independently of any time scale and here we strictly distinguish between sequences and time series. If the MLBS is to be played as a time series, the time steps are given by the above-mentioned base time \(T_{\textrm{base}}\) with \(f_{\textrm{base}}=\frac{1}{T_{\textrm{base}}}\).

3 Discrete spectrum

The discrete Fourier transform (DFT) [22] can be calculated via

$$\begin{aligned} \textrm{DFT}_n[x_k] = X_n = \frac{1}{N}\sum _{k=0}^{N-1}x_k\,e^{-j2\pi nk/N}, \end{aligned}$$
(4)

where N is the length of the dataset (see Appendix 1.2 for a discussion of the scaling factor 1/N and the notation). For the MLBS, \(N=p\) is used.

The total length \(pT_{\textrm{base}}\) of the time series determines the frequency resolution via

$$\begin{aligned} \Delta f = \frac{1}{p\,T_{\textrm{base}}} = \frac{1}{p} f_{\textrm{base}}~ \end{aligned},$$
(5)

while the maximum frequency that contains information (as per the Nyquist–Shannon sampling theorem) is given by

$$\begin{aligned} f_{\textrm{max}} = \frac{1}{2} \frac{p-1}{p} f_{\textrm{base}} \approx \frac{1}{2} f_{\textrm{base}}. \end{aligned}$$
(6)

Note that Eq. (6) is valid here since p is always odd for an MLBS.

When the length of the dataset matches one full period, \(N=p\), the absolute values \(|B_n|\) of the DFT of an MLBS sequence \(\{b_k\}\) are given by

$$\begin{aligned} |B_n|&= {\left\{ \begin{array}{ll} \frac{1}{p} &{} \text {for }n=0\\ \frac{\sqrt{p+1}}{p} &{} \text {for }n\in \{1,2,...,p-1\} \end{array}\right. } \end{aligned}$$
(7)

(see Appendix 3 for the derivation). Examples are shown in Fig. 5 for a 4-bit and a 7-bit MLBS, respectively. The scaling of the frequency axis is done by assuming \(T_{\textrm{base}}=1\hbox { s}\) for both sequences.

Fig. 5
figure 5

Absolute values \(|B_n|\) of the DFT of a 4-bit and a 7-bit MLBS with \(T_{\textrm{base}}=1\hbox { s}\) for exactly one full period each

First of all, the DFT produces distinct peaks that can be attributed to certain frequencies, and Fig. 5 illustrates the effects of Eqs. (5), and (6). The higher the number of bits, the better becomes the approximation of Eq. (6). Simultaneously, increasing the number of bits results in smaller frequency bins so that the amplitudes also become smaller.

Secondly, the spectrum of an MLBS is flat, every frequency component is equally present (except a near-zero DC value). This property underlines the white noise characteristic of an MLBS. In the literature, however, the reader often finds the statement that the spectrum of an MLBS has a \({{\,\textrm{sinc}\,}}(fT_{\textrm{base}})\)-shape and the flatness thus would only apply to the lowest frequencies. This is not correct for an MLBS as a sequence. The error occurs by using the term “MLBS” for the sequence itself and the time series that additionally gets filtered by a ZOH process synonymously. The latter will be discussed in the next section.

The property R-1 results in a remaining nonzero mean value of the MLBS and is responsible for the nonzero DC value that occurs in its DFT. The higher the number of bits, the lower this value becomes. However, because of the increased frequency resolution that comes with a longer period, higher bit numbers enable low-frequency system excitation and, hence, more reliable system identification results for low frequencies, as was documented in [14].

4 Sampled MLBS

Often, the MLBS is used as an (discrete-time) input sequence for an arbitrary waveform generator (AWG) whose (continuous-time) voltage output can approximately be described as the discrete-time MLBS processed by a ZOH element. (Note that this is only a good approximation if the base time is sufficiently larger than the rise time of the AWG and if ringing phenomena can be neglected—both will be assumed in the following.) Any measurement of this continuous-time signal will be sampled, and we denote the time difference between the samples as \(T_{\textrm{sample}}\) and the sample frequency as \(f_{\textrm{sample}}=\frac{1}{T_{\textrm{sample}}}\), respectively.

In the following, we assume \(T_{\textrm{base}}\) to be constant to evaluate the effects of the other parameters.

A mathematical description of a ZOH-processed continuous-time MLBS is obtained by the convolution of the MLBS with a rectangular pulse of width \(T_{\textrm{base}}\). Since the sampled result is again a discrete sequence, a simpler description of this process, avoiding the continuous-time domain, can be made by assuming that \(f_{\textrm{sample}}\) is an integer multiple of \(f_{\textrm{base}}\), \(f_{\textrm{sample}}=k_0 f_{\textrm{base}}\), with \(k_0\in \mathbb {N}\), so that the sampled MLBS is produced by repeating the values of the base MLBS \(k_0-1\) times and every \(k_0\)-th sample matches the base MLBS sample. For convenience, we denote the MLBS consisting of repeated values as “sampled MLBS” because the same result would be obtained by firstly generating a continuous-time signal by a ZOH process and then sampling this signal to obtain the sampled MLBS.

A comparison of the sampled MLBS, the base MLBS and the ideal continuous-time ZOH-processed MLBS is shown in Fig. 6.

Fig. 6
figure 6

Example of a sampled 4-bit MLBS compared to the base MLBS and the ZOH-processed MLBS

The sampling process alters the autocorrelation function and the spectrum of the MLBS. Calculating \(R_{\beta \beta }[l]\) for the sampled MLBS sequence \(\{\beta _k\}\) with \(k_0=3\) results in the autocorrelation function shown in Fig. 7.

Fig. 7
figure 7

Autocorrelation function \(R_{\beta \beta }[l]\) of a 4-bit MLBS sampled with \(k_0=3\)

Comparing this result with Fig. 4, one notices that the peaks occur at \(k_0\)-times the lag for the base MLBS as expected due to the higher number of samples. But there are also smaller side-peaks broadening the distinct peaks of the base MLBS. This again is to be expected: For the application of Eq. (14) with \(N=k_0p\), the sampled MLBS can be regarded as \(k_0\) instances of the base MLBS, with one sampling step between each instance. For lag \(l=0\mod k_0p\) all of these \(k_0\) base MLBSs overlap. Increasing the lag l results in l less overlapping base MLBSs up to no overlap for \(k_0\le l\le N-k_0\). For \(N-k_0+1\le l\le N,\) the overlap increases again, resulting in

$$\begin{aligned} R_{\beta \beta }[l]&= {\left\{ \begin{array}{ll} \frac{1}{k_0p}\Big ((k_0-|l|)p-|l|\Big ) &\quad \text {for}~l\in \{0,\pm 1,...,\pm k_0\}\mod k_0p,\\ -\frac{1}{p} &\quad \text {else.} \end{array}\right. } \end{aligned}$$

Thus, the sampling results in an approximation of triangles instead of the distinct peaks of the base MLBS. While the resolution of this approximation can be increased with \(k_0\), the negative “floor” remains unaffected (and still depends on the number of bits).

In order to obtain the spectrum of a sampled MLBS, another degree of freedom can be introduced that has been left out for the pure MLBS in the previous section: The sampling/observation time does not need to be restricted to only one full period. However, to circumvent the problems arising from sampling only a fraction of a period [21] we shall restrict ourselves to sampling that matches full periods. Thus, the total length of the dataset is \(NT_{\textrm{sample}}\) with \(N=k_0n_0p\) and the sampling matches a total of \(n_0\) periods (\(n_0\in \mathbb {N}\)).

The frequency resolution is then given by

$$\begin{aligned} \Delta f = \frac{1}{NT_{\textrm{sample}}} = \frac{1}{k_0n_0p\,T_{\textrm{sample}}} = \frac{1}{n_0p} f_{\textrm{base}}, \end{aligned}$$
(8)

which contains Eq. (5) as a special case for \(k_0=1\), \(n_0=1\). Likewise,

$$\begin{aligned} f_{\textrm{max}} = {\left\{ \begin{array}{ll} \frac{1}{2} \frac{k_0n_0p-1}{k_0n_0p} f_{\textrm{sample}} &{}\text {if }N\text { is odd}\\ \frac{1}{2} \frac{k_0n_0p}{k_0n_0p} f_{\textrm{sample}} &{}\text {if }N\text { is even} \end{array}\right. } \approx \frac{1}{2} f_{\textrm{sample}} = \frac{1}{2} k_0 f_{\textrm{base}}. \end{aligned}$$
(9)

Equation (9) can be regarded as a generalized version of Eq. (6).

The two degrees of freedom, the sampling frequency (determined by \(k_0\)) and the number \(n_0\) of periods, thus alter the spectrum of the base MLBS in independent ways:

  • The frequency resolution \(\Delta f\), Eq. (8), can be increased by including more periods in the dataset, while it is unaffected by the sampling time.

  • The maximum frequency \(f_{\textrm{max}}\), Eq. (9), on the other hand is unaffected by the number of periods and only increases with the sampling frequency.

To calculate the DFT of a sampled MLBS, the base MLBS needs to be convoluted with a scaled rectangular function

$$\begin{aligned} \underset{k_0,N}{\overline{\mathop {\textrm{rect}}\limits }}{}_k = \frac{1}{k_0}~\underset{k_0,N}{\mathop {\textrm{rect}}\limits }{}_k \end{aligned}$$

of length N with

$$\begin{aligned} \underset{k_0,N}{\mathop {\textrm{rect}}\limits }{}_k&= {\left\{ \begin{array}{ll} 1 &{} \text {for } 0 \le k < k_0\\ 0 &{} \text {for } k_0 \le k \le N-1 \end{array}\right. } \end{aligned}$$

to obtain the representation

$$\begin{aligned}{}[\beta _k] = [b_k] * \left[ \underset{k_0,N}{\overline{\mathop {\textrm{rect}}\limits }}{}_k\right] \end{aligned}$$

with

$$\begin{aligned} \beta _n = \sum _{k=0}^{N-1} b_k \underset{k_0,N}{\overline{\mathop {\textrm{rect}}\limits }}{}_{n-k} \end{aligned}$$

(defined in [16] with the same definition of the DFT as Eq. (20)) of the sampled MLBS. Due to the convolution theorem [16], the absolute values \(|B_n|\) of the sampled MLBS’s DFT are now given by the product of the absolute values of the DFT of the base MLBS (Eq. (7)) and those of the DFT of that rectangular function. Applying Eq. (4) yields

$$\begin{aligned} \textrm{DFT}_n\left[ \underset{k_0,N}{\overline{\mathop {\textrm{rect}}\limits }}{}_k\right] = \frac{1}{k_0}\frac{\sin (\pi nk_0/N)}{\sin (\pi n/N)} e^{-j\pi n(k_0-1)/N} \end{aligned},$$

and with Eq. (7) one obtains

$$\begin{aligned} |B_n|_{\textrm{expected}} = \left| \frac{\sqrt{p+1}}{p}\right| \cdot \left| \frac{1}{k_0}\frac{\sin (\pi nk_0/N)}{\sin (\pi n/N)}\right| \approx \left| \frac{\sqrt{p+1}}{p} \frac{\sin (\pi nk_0/N)}{\pi nk_0/N}\right| \end{aligned}$$
(10)

for \(n\ne 0\).

Thus, with \(f=n\Delta f=\frac{n}{NT_{\textrm{sample}}}=\frac{nk_0}{NT_{\textrm{base}}}\), they approximate the \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape,

$$\begin{aligned} |B(f)|_{\textrm{expected}} \approx \left| \frac{\sqrt{p+1}}{p}\,\frac{\sin (\pi fT_{\textrm{base}})}{\pi fT_{\textrm{base}}}\right| = \left| \frac{\sqrt{p+1}}{p}\,{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})\right| . \end{aligned}$$

Figure 8 shows that this is indeed the case, even for a very low sampling rate with \(k_0=2\). The visible deviation for \(k_0=2\) can be attributed to the bad approximation \(\sin (\pi n/N)\approx \pi n/N\) of the denominator in Eq. (10) for low sampling rates \(k_0.\) (Note that \(N=k_0n_0p\) and that the numerator is independent of \(k_0.\)) Sampling with \(k_0=10\) leads to a nearly undisturbed spectrum up to half \(f_{\textrm{max}}\), see Fig. 9. The maximum frequency increases with \(k_0\) according to Eq. (9).

Fig. 8
figure 8

Absolute values \(|B_n|\) of the DFT of a 4-bit MLBS with \(T_{\textrm{base}}=1\hbox { s}\) for exactly one full period and sampled with different \(k_0\) in comparison with the expected \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape

Fig. 9
figure 9

Absolute values \(|B_n|\) of the DFT of a 4-bit MLBS with \(T_{\textrm{base}}=1\hbox { s}\) for exactly one full period and sampled with \(k_0=10\) in comparison with the expected \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape

The expected \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape of the amplitudes does not cover the near-zero DC value of the sampled MLBS.

Increasing the number \(n_0\) of periods included in the DFT calculation results in an increased frequency resolution but as shown in Fig. 10 this does not provide additional information. Particularly the very low-frequency region is not “enhanced” (for system identification purposes) by adding more periods because only the number of zeroes is increased. This is in contrast to what the expected \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape might suggest if one thinks increasing the frequency resolution should lead to a better “fit” to this expected shape.

Fig. 10
figure 10

Absolute values \(|B_n|\) of the DFT of a 4-bit MLBS with \(T_{\textrm{base}}=1\hbox { s}\) for exactly 3 full periods and sampled with \(k_0=3\) in comparison with the expected \(|{{\,\textrm{sinc}\,}}(fT_{\textrm{base}})|\)-shape

Until now, the discussion only included amplitude spectra. Unfortunately, in the literature, the amplitude spectra depicted herein are sometimes said to follow a \({{\,\textrm{sinc}\,}}^2(fT_{\textrm{base}})\)-shape (what they don’t) and called power spectra (what they aren’t).

The raw discrete power spectral density \(S_{\beta \beta }[n]\) (not scaled with the frequency resolution \(\frac{1}{\Delta f}\) nor with an ohmic resistor \(\frac{1}{R_0}\)—see Eq. (28) for a version of the PSD that accounts for this scaling and physical units) of a sampled MLBS is obtained according to Eq. (26) as the DFT of the autocorrelation function \(R_{\beta \beta }[l]\). Since the autocorrelation function of a sampled MLBS approximates a triangle (see Fig. 7), the PSD will approximate the \({{\,\textrm{sinc}\,}}^2(fT_{\textrm{base}})\)-shape [7],

$$\begin{aligned} S_{\beta \beta }[n]_{\textrm{expected}}&\approx \frac{p+1}{p^2}\,\frac{\sin ^2(\pi nk_0/N)}{(\pi nk_0/N)^2},\\ S_{\beta \beta }(f)_{\textrm{expected}}&\approx \frac{p+1}{p^2}\,\frac{\sin ^2(\pi fT_{\textrm{base}})}{(\pi fT_{\textrm{base}})^2} = \frac{p+1}{p^2}\,{{\,\textrm{sinc}\,}}^2(fT_{\textrm{base}}), \end{aligned}$$

as shown in Fig 11.

Fig. 11
figure 11

Raw discrete PSD \(S_{\beta \beta }[n]\) of a 4-bit MLBS with \(T_{\textrm{base}}=1\hbox { s}\) for exactly one full period and sampled with \(k_0=3\) in comparison with the expected \({{\,\textrm{sinc}\,}}^2(fT_{\textrm{base}})\)-shape

However, the discrete PSD will suffer from the same deviation from this expected shape due to the approximation made for the amplitude spectra (Eq. (10)) if the sampling rate \(k_0\) isn’t high enough.

One particular frequency of interest is the one where the PSD drops by \(-3\hbox { dB}\) [7, 10] given by \(S_{\beta \beta }(f_{-3\,\textrm{dB}})_{\textrm{expected}} = \frac{1}{2}\) as

$$\begin{aligned} f_{-3\,\textrm{dB}} \approx 0.443\frac{1}{T_{\textrm{base}}}, \end{aligned}$$
(11)

which corresponds to \(n_{-3\,\textrm{dB}} \approx 0.443\frac{N}{k_0}\).

4.1 Guidelines

For system identification purposes, the user can now follow these guidelines (in accordance with [9]):

  1. A

    Estimate the bandwidth of interest, i.e., estimate the minimum and maximum frequency \(f_{\textrm{BW,min}}\) and \(f_{\textrm{BW,max}}\), respectively, that are to be excited.

  2. B

    Equation (11) with \(f_{-3\,\textrm{dB}}=f_{\textrm{BW,max}}\) leads to the necessary \(T_{\textrm{base}}\).

  3. C

    Given \(T_{\textrm{base}}\), Eq. (5) with \(\Delta f=f_{\textrm{BW,min}}\) gives the necessary period p and thus the required number n of bits for the MLBS.

  4. D

    A common advice is to sample 10 times faster than \(f_{\textrm{BW,max}}\) [23], \(f_{\textrm{sample}}=10f_{\textrm{BW,max}}\approx 4.43f_{\textrm{base}}\), leading to \(k_0=5\).

  5. E

    For the number \(n_0\) of periods in the observation, there are different aspects to consider, like time constraints for the measurement or the possibility to average over multiple periods for a better signal-to-noise ratio [9,10,11].

  6. F

    Lastly, the amplitude of the MLBS signal has to be chosen. Since high amplitudes offer a better signal-to-noise ratio but can also excite unwanted nonlinear dynamics [9, 10], this decision strongly depends on the system itself and might not be set a priori, requiring some iterations. The precise definition of the PSD (28), including the correct scaling factors, allows for a better estimation of the suitable signal amplitude.

Deviations from these guidelines may be necessary due to constraints on the available memory [9].

4.2 Application example

Consider, for example, a radio-frequency system whose transfer function shall be identified in the frequency range from \(f_{\textrm{BW,min}}=600\hbox { kHz}\) to \(f_{\textrm{BW,max}}=20\hbox { MHz}\) using an arbitrary waveform generator (AWG) to provide an MLBS as broadband excitation signal. In order to reach sufficient signal power at \(20 \hbox { MHz}\), a base time less than \(22.15\hbox { ns}\) is necessary (see guideline B), so, e.g., \(T_{\textrm{base}}=20\hbox { ns}\) is chosen. If the AWG’s rise time isn’t sufficiently faster, the excitation signal will suffer from distortions. As mentioned above, in the literature, the raw discrete PSD \(S_{\beta \beta }(f)\) sometimes gets confused with the amplitude spectrum B(f), leading to \(T_{\textrm{base}}^*=0.603/f_{\textrm{BW,max}}\approx 30\hbox { ns}\) and thus to \(S_{\beta \beta }^*(20\hbox { MHz})\approx 0.25\), i.e., only half the intended value. Following the above guideline C, a period \(p\ge 84\) is required to excite the system down to \(600\hbox { kHz}\), leading to a shift register length of \(n=7\). In this example, the wrong \(T_{\textrm{base}}^*\) would lead to \(p^*\ge 56\) and thus to only \(n^*=6\). So the wrong \(T_{\textrm{base}}^*\) does not only affect the power at \(f_{\textrm{BW,max}}\) but also leads to not being able to identify the system at \(f_{\textrm{BW,min}}\) due to the MLBS’s period being too short. As discussed above, the necessary number of bits to reach \(f_{\textrm{BW,min}}\) cannot be reduced by simply lengthening the excitation signal via recording \(n_0>1\) periods. Lastly, when the AWG’s output is amplified with a solid-state amplifier to an amplitude of \(\hat{u}=150\hbox { V}\), the average power delivered to a pure resistive load of \(R_0=50\,\Omega\) is \(\bar{P}=\frac{\hat{u}^2}{R_0}=450\hbox { W}\), which is in accordance with Eq. (32). If one would neglect the scaling factor \(\Delta f\) while calculating the PSD (Eq. (28)), Eq. (32) would result in \(\bar{P}^*\approx 160\hbox { W}\cdot \hbox {MHz}\), which does not only have the wrong unit but also, if one wouldn’t pay attention to the unit at all, quickly leads to thinking of \(\bar{P}^{**}\approx 160\hbox { W}\), underestimating the average power by a factor of almost 3. If the system can handle \(500\hbox { W},\) this wrong estimation can lead to the fatal conclusion that increasing the amplitude by a factor of \(\sqrt{3}\approx 1.7\) for a better signal-to-noise ratio would still be tolerable, ultimately damaging the system.

If hardware limitations like the AWG’s rise time or other filtering effects shall be taken into account for the modeling of the excitation signal, the formulas presented herein can be applied to the filtered MLBS in a consistent way by using the convolution theorem.

5 Summary and conclusion

Clear definitions for MLBS signals were given which distinguish between a base MLBS on the one hand and a sampled MLBS (which is the result of a ZOH process applied to the base MLBS and re-sampling it) on the other hand. Furthermore, signal processing definitions such as the DFT, the autocorrelation function and the power spectral density were introduced with suitable scaling factors in order to allow a meaningful physical interpretation. One conclusion is that the spectrum of any base MLBS is white, whereas the spectrum of any sampled MLBS approximates a sinc function. This resolves contradictory or at least inconsistent statements that can be found in the literature.

Availability of data and materials

Not applicable.

Abbreviations

AWG:

Arbitrary waveform generator

BW:

Bandwidth

DC:

Direct current

DFT:

Discrete Fourier transform

FFT:

Fast Fourier transform

LFSR:

Linear feedback shift register

LSB:

Least significant bit

MLBS:

Maximum length binary sequence

PI:

Proportional integral (type of controller)

PSD:

Power spectral density

XOR:

Exclusive or

ZOH:

Zero-order hold

References

  1. S.W. Golomb, Shift Register Sequences (Holden-Day Inc, San Fransisco, 1967)

    Google Scholar 

  2. F.J. MacWilliams, N.J.A. Sloane, Pseudo-random sequences and arrays, in Proceedings of the IEEE, vol. 64 (1976)

  3. J. Shao, A.I. Karsilayan, C.T. Rodenbeck, J. Silva-Martinez, An efficient sinusoid-like pseudo random sequence modulator/demodulator system with reduced adjacent channel leakage and high rejection to random and systematic interference. IEEE Trans. Circuits Syst. I Regul. Papers 67(11), 3790–3803 (2020). https://doi.org/10.1109/tcsi.2020.3020851

    Article  MathSciNet  Google Scholar 

  4. J. Kim, H. Kim, Length of pseudorandom binary sequence required to train artificial neural network without overfitting. IEEE Access 9, 125358–125365 (2021). https://doi.org/10.1109/access.2021.3111092

    Article  Google Scholar 

  5. S. Maitra, K.C. Gupta, A. Venkateswarlu, Multiples of primitive polynomials and their products over GF(2), in SAC 2002, ed. by K. Nyberg, H. Heys. LNCS, vol. 2595 (Springer, Berlin, 2003), pp.214–231

    Google Scholar 

  6. A.K. Tangirala, Principles of System Identification—Theory and Practice (CRC Press, Taylor & Francis Group, LLC, Boca Raton, 2015). https://doi.org/10.1201/9781315222509

    Book  Google Scholar 

  7. K.R. Godfrey, Introduction to binary signals used in system identification, in International Conference on Control (IEEE, Edinburgh, 1991)

  8. D.P. O’Leary, V. Honrubia, On-line identification of sensory systems using pseudorandom binary noise perturbations. Biophys. J. 15(6), 505–532 (1975). https://doi.org/10.1016/s0006-3495(75)85835-8

    Article  Google Scholar 

  9. M. Vilkko, T. Roinila, Designing maximum length sequence signal for frequency response measurement of switched mode converters, in Nordic workshop on power and industrial electronics (NORPIE, 2008)

  10. J. Sihvo, T. Messo, T. Roinila, R. Luhtala, Online internal impedance measurements of li-ion battery using PRBS broadband excitation and Fourier techniques: methods and injection design, in The 2018 International Power Electronics Conference (IEEJ Industry Application Society, Niigata, 2018)

  11. T. Roinila, H. Abdollahi, E. Santi, Frequency-domain identification based on pseudorandom sequences in analysis and control of DC power distribution systems: a review, in IEEE Transactions on Power Electronics (2021)

  12. J. Schweickhardt, Modeling and optimization of barrier-bucket RF systems. PhD thesis (TU Darmstadt, Darmstadt, 2020). Institute for Accelerator Science and Electromagnetic Fields. http://tubiblio.ulb.tu-darmstadt.de/125363/

  13. G. Heinzel, A. Rüdiger, R. Schilling, Spectrum and spectral density estimation by the Discrete Fourier transform (DFT), including a comprehensive list of window functions and some new flat-top windows. Technical report (2002). https://hdl.handle.net/11858/00-001M-0000-0013-557A-5

  14. Z. Ren, G.G. Zhu, Pseudo-random binary sequence closed-loop system identification error with integration control, in Proceedings of the Institution of Mechanical Engineers, Part I: Journal of Systems and Control Engineering, vol. 223 (2009)

  15. G.G. Kumar, S.K. Sahoo, P.K. Meher, 50 years of FFT algorithms and applications. Circuits Syst. Signal Process. 38(12), 5665–5698 (2019). https://doi.org/10.1007/s00034-019-01136-8

    Article  Google Scholar 

  16. D. Müller-Wichards, Transformationen und Signale (Springer, Wiesbaden, 2013)

    Book  Google Scholar 

  17. E.O. Brigham, The Fast Fourier Transform and Its Applications (Prentice Hall, Englewood Cliffs, New Jersey, 1988)

    Google Scholar 

  18. R. Lidl, H. Niederreiter, Finite Fields (Cambridge University Press, Cambridge, 1997)

    Google Scholar 

  19. W. Stahnke, Primitive binary polynomials. Math. Comput. 27, 977–980 (1973)

    Article  MathSciNet  Google Scholar 

  20. D.V. Sarvate, M.B. Pursley, Crosscorrelation properties of pseudorandom and related sequences, in Proceedings of the IEEE, vol. 68 (1980)

  21. M. Baldi, F. Chiaraluce, N. Boujnah, R. Garello, On the autocorrelation properties of truncated maximum-length sequences and their effect on the power spectrum. IEEE Trans. Signal Process. 58(12), 6284–6297 (2010). https://doi.org/10.1109/tsp.2010.2070500

    Article  MathSciNet  Google Scholar 

  22. H. Klingbeil, U. Laier, D. Lens, Theoretical Foundations of Synchrotron and Storage ring RF Systems (Springer, Cham, 2015). https://doi.org/10.1007/978-3-319-07188-6

    Book  Google Scholar 

  23. L. Ljung, System Identification: Theory for the User (Prentice Hall, Upper Saddle River, 1999)

    Google Scholar 

  24. K.C. Lo, A novel algorithm for computing autocorrelation of randomly sampled sequences. Circuits Syst Signal Process 18(6), 525–537 (1999). https://doi.org/10.1007/bf01269914

    Article  Google Scholar 

  25. L. Tang, Y. Zhu, Q. Fu, Fast algorithm for designing periodic/aperiodic sequences with good correlation and stopband properties. EURASIP J. Adv. Signal Process. (2018). https://doi.org/10.1186/s13634-018-0579-z

    Article  Google Scholar 

  26. A.H. Zemanian, Distribution Theory and Transform Analysis—An Introduction to Generalized Functions, with Applications (McGraw-Hill Book Company, New York, 1965)

    Google Scholar 

  27. P. Sysel, P. Rajmic, Goertzel algorithm generalized to non-integer multiples of fundamental frequency. EURASIP J. Adv. Signal Process. (2012). https://doi.org/10.1186/1687-6180-2012-56

    Article  Google Scholar 

  28. A. Nasser, A. Mansour, K.C. Yao, H. Abdallah, H. Charara, Spectrum sensing based on cumulative power spectral density. EURASIP J. Adv. Signal Process. (2017). https://doi.org/10.1186/s13634-017-0475-y

    Article  Google Scholar 

  29. E. Hänsler, Statistische Signale-Grundlagen und Anwendungen (Springer, Berlin, Heidelberg, 2001). https://doi.org/10.1007/978-3-642-56674-5

    Book  Google Scholar 

  30. L. Cohen, Generalization of the Wiener–Khinchin theorem. IEEE Signal Process. Lett. 5(11), 292–294 (1998). https://doi.org/10.1109/97.728471

    Article  Google Scholar 

  31. I.S. Gradshteyn, I.M. Ryzhik, Table of Integrals, Series and Products, 7th edn. (Elsevier Academic Press, Burlington, 2007)

    Google Scholar 

Download references

Acknowledgements

Not applicable.

Funding

Open Access funding enabled and organized by Projekt DEAL. This study was partly funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 264883531 – GRK 2128 “AccelencE.”

Author information

Authors and Affiliations

Authors

Contributions

This work is the product of a lively exchange of the authors and both contributed partially to every aspect. Specifically, Sebastian Orth collected the information on MLBS, did the proofs, calculations and plots for the main part and prepared the manuscript. Harald Klingbeil provided the definitions in Appendix 1, ensured their consistency, and proofread the manuscript. All authors read and approved the final manuscript.

Corresponding author

Correspondence to Sebastian Orth.

Ethics declarations

Competing interests

The authors declare that they have no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendix 1: Motivation of discrete-time formulas and scaling factors

1.1 1.1 Autocorrelation functions

The autocorrelation function of a real-valued time-continuous function x(t) of finite energy is defined as

$$\begin{aligned} r_{xx}(\tau ) = \int _{-\infty }^{\infty } x(t+\tau )x(t)\textrm{d} t. \end{aligned}$$

For a real-valued time-continuous function x(t) of finite power (like a bounded periodic function), however, this integral does not exist and one defines

$$\begin{aligned} \boxed {\tilde{R}_{xx}(\tau ) = \lim \limits _{T\rightarrow \infty } \frac{1}{T} \int _{-T/2}^{T/2} x(t+\tau )x(t)\textrm{d} t} \end{aligned}$$
(12)

instead. Please note that the division by T leads to a different physical unit and there exists no combined definition for both cases. However, the definition Eq. (12) can in principle be applied to a signal of finite energy as well. The resulting autocorrelation function will then be zero, ultimately leading to the average power being zero as well—which is indeed the correct value for a finite-energy signal.

For a periodic function with period \(T_0\), the integral can be evaluated by setting \(T=n_0T_0\) with \(n_0\in \mathbb {N}\):

$$\begin{aligned} \tilde{R}_{xx}(\tau )&= \lim \limits _{n_0\rightarrow \infty } \frac{1}{n_0T_0} \int _{-n_0T_0/2}^{n_0T_0/2} x(t+\tau )x(t)\textrm{d} t \end{aligned}$$

Due to the periodicity, every integral over one full period gives the same result. Thus, the formula simplifies to just one integral over one full period, whose bounds can also be shifted:

$$\begin{aligned} R_{xx}(\tau ) = \frac{1}{T_0} \int _{0}^{T_0} x(t+\tau )x(t)\textrm{d} t \end{aligned}$$

It follows that the same \(R_{xx}(\tau )\) is obtained for an arbitrary observation time T that equals a finite number \(n_0\) of full periods:

$$\begin{aligned} \boxed {R_{xx}(\tau ) = \frac{1}{T} \int _{0}^{T} x(t+\tau )x(t)\textrm{d} t} \end{aligned}$$
(13)

Equation (13) can now be used for the motivation of a corresponding definition for a periodic and time-discrete function. For that purpose, let the sampling be done in N time steps \(\Delta t\) with \(T=N\Delta t\) and \(t_k=k\Delta t\), \(k\in \{0,1,...,N-1\}\). Further define \(x_k=x(t_k)=x(k\Delta t)\). The integral can then be approximated by a Riemann sum:

$$\begin{aligned} R_{xx}(\tau )&\approx \frac{1}{N} \sum _{k=0}^{N-1} x(k\Delta t+\tau )x(k\Delta t) \end{aligned}$$

Assuming \(\tau =l\Delta t\) with \(l\in \mathbb {Z}\) finally yields

$$\begin{aligned} \boxed {R_{xx}[l] = \frac{1}{N} \sum _{k=0}^{N-1} x_{k+l}x_k,} \end{aligned}$$
(14)

which is regarded as a definition for the discrete case, no longer an approximation. We use brackets instead of parentheses to distinguish the discrete versions of our definitions from the time-continuous ones.

The scaling factor \(\frac{1}{N}\) in Eq. (14) ensures that for a large number of samples, i.e., a short sampling time \(\Delta t\), the discrete formula properly approximates the continuous-time result from Eq. (13),

$$\begin{aligned} R_{xx}(\tau ) = R_{xx}(l\Delta t) \approx R_{xx}[l]. \end{aligned}$$
(15)

Note that there are also definitions in the literature which omit this scaling factor [24, 25].

Motivated by these derivations, we consistently use the following definitions:

  • \(T_0\): shortest period of the signal

  • \(T=n_0T_0\): observation time, equals an integer number of periods

  • \(\Delta f=\frac{1}{T}\): frequency resolution

  • \(\Delta t=\frac{T_0}{N_0}=\frac{T}{N}\): time resolution, equals sampling time

  • \(N=n_0N_0\): total number of samples

  • \(N_0\): number of samples per shortest period

1.2 1.2 Fourier transforms

The Fourier transform of a real-valued time-continuous signal is defined as

$$\begin{aligned} \boxed {X(f) = \mathcal {F}_f(x(t)),} \end{aligned}$$
(16)

which is in general meant in the sense of generalized functions/distributions [26]. Please note that parameters like the frequency f and the time t are of course not specified for distributions in the mathematical literature. In this work, however, we add them to clarify the physical dependencies. Equation (16) can be evaluated as

$$\begin{aligned} X(f) = \int _{-\infty }^{\infty }x(t)e^{-j2\pi ft}\textrm{d}t \end{aligned}$$
(17)

if the integral exists.

For a periodic signal, we define

$$\begin{aligned} \boxed {\mathcal{F}\mathcal{C}_f(x(t)) = \int _{-T/2}^{T/2}x(t)e^{-j2\pi ft}\textrm{d}t} \end{aligned}$$
(18)

where T represents the observation time and shall match a number \(n_0\in \mathbb {N}\) of full periods \((T=n_0T_0)\) so that the Fourier coefficients can be obtained via

$$\begin{aligned} c_n = \frac{1}{T}~\mathcal{F}\mathcal{C}_f(x(t))\Big |_{f=n\Delta f} \end{aligned}$$
(19)

with the frequency resolution \(\Delta f=\frac{1}{T}\).

In Eq. (18) as well as in further definitions, we write the function x including its parameter t as an argument x(t) for the operator \(\mathcal{F}\mathcal{C}_f\). Although of course only the function itself is the argument, we add the parameter to distinguish time-continuous and time-discrete versions and to visualize the physical meaning.

For a periodic and time-discrete signal, we define the discrete Fourier transform [22] as

$$\begin{aligned} \boxed {X_n = \textrm{DFT}_n[x_k] = \frac{1}{N}\sum _{k=0}^{N-1}x_k\,e^{-j2\pi nk/N}.} \end{aligned}$$
(20)

The scaling factor \(\frac{1}{N}\) in Eq. (20) ensures that for a large number of samples, i.e., a short sampling time \(\Delta t\), the discrete formula properly approximates the Fourier coefficients (19) of a continuous-time periodic signal. A detailed derivation of Eq. (20) can be found in [22].

The zeroth component of the DFT is the DC component of the signal, while the others can be interpreted as one half of the amplitudes of the corresponding spectral component [22].

A special shaping of the spectrum can also be done by means of windowing [13]. In this work, however, no windowing will be applied since we are dealing with periodic functions only and the sampling shall match full periods. (For computing purposes, this is equivalent to a rectangular or boxcar window of full period length.)

If the sampling does not match full periods and only certain frequencies are of interest, a generalized Goertzel algorithm [27] can be used.

1.3 1.3 Power spectral densities

In the following, the signals x(t) shall be electrical voltages. In order to obtain correct physical units, our definitions for the power spectral density (PSD) will therefore always include an ohmic resistor \(R_0\). For other uses of the PSD, where only its shape is relevant, such scaling factors might be omitted or a different normalization might be applied [28].

The Wiener–Khinchin theorem [29, 30] states that for the continuous-time case the PSD of a signal x(t) can be obtained by the Fourier transform of its autocorrelation function,

$$\begin{aligned} \tilde{S}_{xx}(f) = \mathcal {F}_f\left( \tilde{R}_{xx}(\tau )\right) . \end{aligned}$$
(21)

According to Eqs. (16) and (17), Eq. (21) can be evaluated via

$$\begin{aligned} \tilde{S}_{xx}(f)&= \int _{-\infty }^{\infty } \tilde{R}_{xx}(\tau )\,e^{-j2\pi f\tau }\textrm{d}\tau \end{aligned}$$
(22)

if the integral exists. We therefore define

$$\begin{aligned} \boxed {\widetilde{\textrm{PSD}}_f(x(t)) = \frac{1}{R_0}\,\tilde{S}_{xx}(f) = \frac{1}{R_0}\, \mathcal {F}_f\left( \tilde{R}_{xx}(\tau )\right) .} \end{aligned}$$
(23)

For a periodic signal, however, the autocorrelation function is periodic as well. Thus, the integral in Eq. (22) does not converge and Eq. (21) results in distributions [26]. Therefore, we use

$$\begin{aligned} S_{xx}(f) = \mathcal{F}\mathcal{C}_f\left( R_{xx}(\tau )\right) \end{aligned}$$

which can be evaluated according to Eq. (18) as

$$\begin{aligned} S_{xx}(f) = \int _{-T/2}^{T/2} R_{xx}(\tau )\,e^{-j2\pi f\tau }\textrm{d}\tau \end{aligned}$$
(24)

to define the PSD of a time-continuous periodic signal as

$$\begin{aligned} \boxed {\textrm{PSD}_f(x(t)) = \frac{1}{R_0}\,S_{xx}(f) = \frac{1}{R_0}\, \mathcal{F}\mathcal{C}_f\left( R_{xx}(\tau )\right) .} \end{aligned}$$
(25)

For a discrete-time periodic signal, the PSD can be defined in an analog way: Beginning with

$$\begin{aligned} S_{xx}[n] = \textrm{DFT}_n\big [R_{xx}[l]\big ], \end{aligned}$$
(26)

which—according to Eq. (20)—can be calculated as

$$\begin{aligned} S_{xx}[n] = \frac{1}{N} \sum _{l=0}^{N-1}R_{xx}[l]\,e^{-j2\pi nl/N}, \end{aligned}$$
(27)

we define

$$\begin{aligned} \boxed {\textrm{PSD}_n[x_k] = \frac{1}{R_0} \frac{1}{\Delta f}\,S_{xx}[n] = \frac{1}{R_0} \frac{1}{\Delta f}\, \textrm{DFT}_n\big [R_{xx}[l]\big ].} \end{aligned}$$
(28)

Definition (28) also includes the scaling factor \(\frac{1}{\Delta f}=T=N\Delta t\) to ensure

$$\begin{aligned} \textrm{PSD}_f(x(t)) = \textrm{PSD}_{f_n}(x(t)) \approx \textrm{PSD}_n[x_k] \end{aligned}$$

for the frequencies \(f_n=n\Delta f\) with the frequency resolution \(\Delta f=\frac{1}{T}=\frac{1}{N\Delta t}\) if the sampling time \(\Delta t\) is short enough. This can be proven by approximating the integral in Eq. (24) (with shifted bounds) by a Riemann sum using \(\tau =l\Delta t\) and Eq. (15):

$$\begin{aligned} \textrm{PSD}_{f_n}(x(t)) = \frac{1}{R_0} \int _{0}^{T} R_{xx}(\tau )\,e^{-j2\pi f_n\tau }\textrm{d}\tau \approx \frac{1}{R_0} \frac{1}{\Delta f}\, \textrm{DFT}_n\big [R_{xx}[l]\big ] \end{aligned}$$

The discrete version of the PSD is periodic with period N (inherited from the DFT [22]), as can be seen from Eq. (27):

$$\begin{aligned} S_{xx}[n+N]&= \frac{1}{N} \sum _{l=0}^{N-1}R_{xx}[l]\,e^{-j2\pi (n+N)l/N} = S_{xx}[n] \end{aligned}$$

1.4 1.4 Average powers

The average power \({\bar{P}}\) of a real-valued time-continuous voltage signal x(t) can be calculated directly as

$$\begin{aligned} \bar{P} = \frac{1}{R_0} \lim \limits _{T\rightarrow \infty } \frac{1}{T} \int _{-T/2}^{T/2} |x(t)|^2\,\textrm{d}t. \end{aligned}$$
(29)

With the definitions of the PSD, the average power can also be calculated as

$$\begin{aligned} \boxed {\bar{P} = \int _{-\infty }^{\infty }\widetilde{\textrm{PSD}}_f(x(t))\,\textrm{d}f} \end{aligned}$$
(30)

for a time-continuous signal, as

$$\begin{aligned} \boxed {\bar{P} = \int _{-\infty }^{\infty }\textrm{PSD}_f(x(t))\,\textrm{d}f} \end{aligned}$$
(31)

for a time-continuous and periodic signal, and as

$$\begin{aligned} \boxed {\bar{P} = \sum _{n=0}^{N-1}\textrm{PSD}_n[x_k]\,\Delta f} \end{aligned}$$
(32)

for a time-discrete and periodic signal.

The following section will provide an example for this fact.

Appendix 2: Analytical example: cosine signal

A large variety of periodic functions can be represented by Fourier series. Therefore, our example in this appendix is a cosine signal which may be regarded as a building block of such a Fourier series.

Let \(x(t)={\hat{u}}\cos (\omega _0 t)\) with amplitude \({\hat{u}}\in \mathbb {R}^+\) measured in Volts, angular frequency \(\omega _0 = 2\pi f_0=\frac{2\pi }{T_0}\) and period \(T_0\).

The autocorrelation function calculated with Eq. (13) for \(T=n_0T_0\) is

$$\begin{aligned} R_{xx}(\tau )&= \frac{1}{T} \int _{0}^{T} \hat{u}^2\cos (\omega _0 (t+\tau ))\cos (\omega _0 t)\textrm{d} t = \frac{\hat{u}^2}{2} \cos (\omega _0 \tau ). \end{aligned}$$
(33)

Sampling with \(T_0=N_0\Delta t\), thus \(\omega _0 = 2\pi \frac{1}{N_0\Delta t}\), together with \(\tau =l\Delta t\) yields

$$\begin{aligned} R_{xx}(l\Delta t)&= \frac{\hat{u}^2}{2} \cos \left( \frac{2\pi }{N_0}l\right) , \end{aligned}$$

which is consistent with the result obtained by directly applying Eq. (14) with \(N=n_0N_0\) (and \(N_0>2\)) as the discrete definition (the necessary formulas can be found as 1.314 3. and 1.341 3. in [31]):

$$\begin{aligned} R_{xx}[l]&= \frac{1}{N} \sum _{k=0}^{N-1} \hat{u}^2\cos \left( \frac{2\pi }{N_0}(k+l)\right) \cos \left( \frac{2\pi }{N_0}k\right) = \frac{\hat{u}^2}{2} \cos \left( \frac{2\pi }{N_0}l\right) \end{aligned}$$
(34)

The physical unit of the autocorrelation function is obviously \(\hbox {V}^{2}\) which is inherited from the signal’s unit.

Based on these results and Eq. (33), the PSD calculated with Eq. (23) as the continuous definition is

$$\begin{aligned} \widetilde{PSD}_f(x(t))&= \frac{1}{R_0}\, \mathcal {F}_f\left( \frac{\hat{u}^2}{2} \cos (\omega _0 \tau )\right) = \frac{\hat{u}^2}{4R_0} \Big (\delta (f-f_0)+\delta (f+f_0)\Big ). \end{aligned}$$
(35)

We obtain Dirac delta distributions [26].

Since the test signal is periodic, Eqs. (24), (25), and (33) can be applied (for an integer number \(n_0\) of periods, \(T=n_0T_0\)) to obtain

$$\begin{aligned} \textrm{PSD}_f(x(t))&= \frac{1}{R_0} \int _{-T/2}^{T/2} \frac{\hat{u}^2}{2} \cos (\omega _0 \tau )\,e^{-j2\pi f\tau }\textrm{d}\tau \nonumber \\&= (-1)^{n_0}\frac{\hat{u}^2}{2R_0\pi } \sin (\pi f T) \frac{f}{f^2-f_0^2} \end{aligned}$$
(36)

From this result, it can be seen that including a higher number \(n_0\) of periods leads to a “convergence” to the Dirac pulses of Eq. (35).

Calculating the PSD with Eq. (28) as the discrete definition using Eq. (27) and (34) yields

$$\begin{aligned} \textrm{PSD}_n[x_k]&= \frac{1}{R_0} \frac{1}{\Delta f} \frac{1}{N} \sum _{l=0}^{N-1} \frac{\hat{u}^2}{2} \cos \left( \frac{2\pi }{N_0}l\right) \,e^{-j2\pi nl/N}\nonumber \\&= \frac{\hat{u}^2}{4R_0\Delta f} \frac{1}{N} \sum _{l=0}^{N-1} \left( e^{-j2\pi \left( \frac{n}{N}-\frac{1}{N_0}\right) l} + e^{-j2\pi \left( \frac{n}{N}+\frac{1}{N_0}\right) l}\right) . \end{aligned}$$
(37)

If \(\left( \frac{n}{N}\mp \frac{1}{N_0}\right) \in \mathbb {Z}\), the corresponding sum is equal to N. For \(\left( \frac{n}{N}\mp \frac{1}{N_0}\right) \notin \mathbb {Z},\) the geometric series’ partial sum formula can be applied to obtain

$$\begin{aligned} \sum _{l=0}^{N-1} e^{-j2\pi \left( \frac{n}{N}\mp \frac{1}{N_0}\right) l}&= \frac{1-e^{-j2\pi \left( n\mp \frac{N}{N_0}\right) }}{1-e^{-j2\pi \left( \frac{n}{N}\mp \frac{1}{N_0}\right) }}. \end{aligned}$$
(38)

For \(N=n_0N_0\) with \(n_0\in \mathbb {N}\) (sampling matches full periods) and with \(m\in \mathbb {Z},\) the condition \(\left( \frac{n}{N}\mp \frac{1}{N_0}\right) \notin \mathbb {Z}\) can be written as

$$\begin{aligned} n&\ne \pm n_0 + mN. \end{aligned}$$
(39)

For every n that fulfils formula (39), the denominators in Eq. (38) are unequal to 0, while the numerators equal 0, leading to the sum being 0. Thus, the sum can be expressed by scaled Kronecker deltas,

$$\begin{aligned} \sum _{l=0}^{N-1} e^{-j2\pi \left( \frac{n \mp n_0}{N}\right) l}&= N\sum _{m=-\infty }^{\infty }\delta [n \mp n_0 - mN], \end{aligned}$$

and Eq. (37) leads to

$$\begin{aligned} \textrm{PSD}_n[x_k]&= \frac{\hat{u}^2}{4R_0\Delta f} \sum _{m=-\infty }^{\infty }\Big (\delta [n - n_0 - mN] +\delta [n + n_0 - mN]\Big ). \end{aligned}$$
(40)

This is the discrete version of Eq. (35). In each discrete period of length \(N=n_0N_0\), two Kronecker deltas are obviously present. For the main period with \(n\in \{0,1,...,N-1\}\), they are located at \(n=n_0\) and at \(n=N-n_0\).

The Dirac deltas in the continuous version correspond to the Kronecker deltas in the discrete version, although both are fundamentally different.

All three expressions (35), (36), and (40) have the same physical unit \(\frac{\hbox {W}}{\hbox {Hz}}\) because due to the property

$$\begin{aligned} \delta (\alpha x)=\frac{1}{|\alpha |}\delta (x) \end{aligned}$$

(where \(\alpha\) carries the unit, whereas x is dimension-free) \(\delta (f \mp f_0)\) has the unit \(\frac{1}{\hbox {Hz}}\). The Kronecker deltas \(\delta [x]\) are of course dimension-free.

If the cosine-shaped voltage x(t) drops over an ohmic resistor \(R_0\), the delivered average power in Watts calculated directly with Eq. (29) is \(\bar{P} = \frac{\hat{u}^2}{2R_0}\).

The same result is firstly obtained via the continuous result (35) and Eq. (30):

$$\bar{P} = \int_{{ - \infty }}^{\infty } {\frac{{\hat{u}^{2} }}{{4R_{0} }}} \left( {\delta (f - f_{0} ) + \delta (f + f_{0} )} \right){\text{d}}f = \frac{{\hat{u}^{2} }}{{2R_{0} }}$$

Of course, Eq. (30) does not represent a classical integral in this case.

Secondly, the same result is delivered by the periodic equation’s result (36) and Eq. (31):

$$\bar{P} = ( - 1)^{{n_{0} }} \frac{{\hat{u}^{2} }}{{R_{0} \pi }}\int_{0}^{\infty } {\frac{{f\sin (\pi fT)}}{{f^{2} - f_{0}^{2} }}} {\text{d}}f = \frac{{\hat{u}^{2} }}{{2R_{0} }}.$$

(The integral can be found as 3.723 10. in [31].)

Lastly, the discrete equation’s result (40) together with Eq. (32) leads to the identical result:

$$\begin{aligned} \bar{P}&= \sum _{n=0}^{N-1}\Bigg (\frac{\hat{u}^2}{4R_0\Delta f} \sum _{m=-\infty }^{\infty }\Big (\delta [n-n_0-mN] +\delta [n+n_0-mN]\Big )\Bigg )\, \Delta f\\&= \frac{\hat{u}^2}{4R_0}\sum _{n=0}^{N-1}\left( \delta [n-n_0]+\delta [n+n_0-N]\right) = \frac{\hat{u}^2}{2R_0} \end{aligned}$$

The step from the first equation to the second line is possible because of the comment after Eq. (40) concerning the main period.

Appendix 3: DFT of an MLBS

Calculating the absolute values of the DFT for an MLBS sequence \(\{b_k\}\) with Eq. (20) (with \(N=p\)) yields

$$\begin{aligned} |B_n|&= \frac{1}{p} \sqrt{\left( \sum _{k=0}^{p-1}b_k\,e^{-j2\pi nk/p}\right) \cdot \left( \sum _{k=0}^{p-1}b_k\,e^{+j2\pi nk/p}\right) } \end{aligned}$$
(41)
$$= \frac{1}{p}\sqrt {\sum\limits_{{k = 0}}^{{p - 1}} {\sum\limits_{{m = 0}}^{{p - 1}} {b_{k} } } b_{m} e^{{ - j2\pi n(k - m)/p}} } .$$
(42)

For \(n=0,\) Eq. (41) can be evaluated directly, using the fact that for the base MLBS \(\sum _{k=0}^{p-1}b_k=1\) holds (R-1), delivering \(|B_0| = \frac{1}{p}\). The same result is obtained for the sampled MLBS \(\{\beta _k\}\) with \(N=k_0n_0p\) and \(k_0,n_0>1\) since in this case \(\sum _{k=0}^{N-1}\beta _k=k_0n_0\) holds.

Now assume \(0<n\le p-1\). With \(l=m-k,\) Eq. (42) becomes

$$\begin{aligned} |B_n|&= \frac{1}{p} \sqrt{\sum _{k=0}^{p-1}\sum _{l=-k}^{p-1-k}b_{k}b_{k+l}\,e^{j2\pi nl/p}}\,. \end{aligned}$$

Since \(\{b_k\}\) is periodic with \(b_{-k}=b_{p-k}\), the sum \(\sum _{l=-k}^{p-1-k}\) can be rearranged to \(\sum _{l=0}^{p-1}\), independent of k, and simplified using Eq. (3):

$$\begin{aligned} |B_n|&= \frac{1}{p} \sqrt{\sum _{l=0}^{p-1}pR_{bb}[l]\,e^{j2\pi nl/p}}\\&= \frac{1}{p} \sqrt{p-\underbrace{\sum _{l=1}^{p-1}\,e^{j2\pi nl/p}}_{=-1}} \end{aligned}$$

Together this leads to

$$\begin{aligned} |B_n|&= {\left\{ \begin{array}{ll} \frac{1}{p} &{} \text {for }n=0\\ \frac{\sqrt{p+1}}{p} &{} \text {for }n\in \{1,2,...,p-1\} \end{array}\right. }. \end{aligned}$$

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Orth, S., Klingbeil, H. Maximum length binary sequences and spectral power distribution of periodic signals. EURASIP J. Adv. Signal Process. 2024, 80 (2024). https://doi.org/10.1186/s13634-024-01177-5

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s13634-024-01177-5

Keywords