0
$\begingroup$

I am analyzing some program responsible for detecting the correct signal in the channel on the receiver side. It seems to me that such an implementation allows for the detection of the correct packets (because I mean packet transmission, from transmitter to receiver) from the received samples. It is known that under normal conditions the energy of the signal is greater than the energy of the noise, so the simplest algorithm to find the beginning of an incoming packet is to measure the energy of the received signal. When no packet is received, the received signal consists of only noise. When a packet begins to be received, the energy of the received signal is increased by the signal component, so the packet can be detected as a change in the energy level of the received signal.

So, the program I am analyzing looks like this (it's MathScript in LabView, it's almost identical to Matlab):

enter image description here

So, the example only divide the samples into groups with size “Bin Size”, and then take the sum of each group, so that we can get the average power. The logic function can be interpreted as this:

enter image description here

%Keep the powerin the lower fractions of bins
low_lim = max(1,floor(0.1*bin_num));
%z = sort(power);
%noise_power = mean(z(1:low_lim));
noise_power = min(power);
signal_power = max(power);
%signal_power = mean(z(bin_size-low_lim:end));

%energy_threshold = max(.01, min(0.009, noise_power*1000));
energy_threshold = max([noise_power*100, (noise_power+signal_power)/2, 1e-6]);

noise_estimation_error = 0;
if 20*log(signal_power/noise_power) < 3
   noise_estimation_error = 1;
end

Now the one issue I don't fully understand is "Energy Threshold". It seems to me that the value 1E-6 was chosen based on brute force analysis (but correct me if this is some value that is often used to determine noise or something like that, because I have no idea), as some sort of reference point. Noise_power is just that. well, the noise power (although I don't know why multiplied by 100, it is possible that a higher order of magnitude allows a more fair detection - I don't know, sadly)

But the thing that bothers me the most is the value of (signal_power+noise_power)/2 - as far as I can see, it's a simple arithmetic average of signal power and noise power. Is this how energy threshold is calculated? What is it then responsible for? Is it just information about where the packet begins to be received and where the noise ends? The processed signal is later "chopped" of unnecessary noise in the receiver, so that only the proper signal containing the packet comes to the demodulation blocks (well, usually it is so, but we know how it works in practice). I've heard that such an implementation allows for greater efficiency, because it relieves the algorithms used in synchronization - they don't have to process portions of the signal, which e.g. are not the actual packets but just part of the noise. This speeds up processing of packets and simplifies their reception.

So is this the thing? Does the "Energy Threshold" carry information about the end of the noise and the beginning of the packet due to the calculated arithmetic mean? Or am I not fully understanding something here?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Does the "Energy Threshold" carry information about the end of the noise and the beginning of the packet due to the calculated arithmetic mean?

There's no such thing as "end of noise": Nothing says that noise can't take values that are as large (or larger) than your signal's power; in "benign" noise, these values are just rare. (And that especially applies for large $L$: Exactly when your noise estimator becomes bearable, i.e. when $L$ is large and thus $N/L-1$ is small, you get potential for larger sums.)

Or am I not fully understanding something here?

Yep, you need to actually consider noise a random variable, and consider its power a random variable, too.

You need to define a noise model. For example, the often-used assumption of Gaussian noise leads to a distribution with fat tails – which means that, yes, noise will eventually be larger than any signal power, if you just look often enough.

The threshold was chosen for some reason that's impossible for us to know – maybe putting an upper bound to the probability of detecting noise as packet, or an upper bound to the probability of dismissing signal as noise (notice that in general, you don't know your signal's power, either, and it's a random variable, too). Maybe someone was just lazy and put any value there. My crystal ball is cloudy – you need to ask whoever designed this. (Or your advisor. Asking your advisor/lab supervisor/professor at this point might be wise. You're missing the whole "Probability in Communications" chapter from the book I linked to in my answer to your question of yesterday. Maybe re-read that chapter? It's not actually sufficient in mathematical depth to derive the result I foreshadow below, but it's a good start.)


Noise_power is just that. well, the noise power (although I don't know why multiplied by 100, it is possible that a higher order of magnitude allows a more fair detection - I don't know, sadly)

It's very much not the noise power!

So, "noise power" is a property of the stochastic process (that means: random variable with a time index); you're only estimating that. This is is hence a noise power estimate, not the noise power.

To make matters worse: this is a biased estimate (in any reasonable noise model I can think of). It's probably not very close to the actual noise power.

Let's quickly derive that. Let $Z_t$ be your noise at (discrete) time $t$, a random variable. I don't know your noise model, and I don't think you've given us that info, so we'll have to just say that $Z_t$ has cumulative density function (cdf)

$$F_{Z_t}(z) := P(Z_t \le z),$$

which is nice enough to also imply a probability density $f_{Z_t}(z):=\frac{\mathrm d\,}{\mathrm d\,z}F_{Z_t}(z)$. We'll also have to assume that your noise has a zero mean, and finite variance $\sigma_{Z_t}^2$ (finite power!) (which applies especially to e.g. Gaussian noise). Because anything else would blow up this answer (and not because that is a good representation of every real-world noise), we'll also have to assume our noise is $L$-blockwise stationary and independent (which applies especially to white noise).

We will now look at the case where you get only noise in all segments.

Let us call the powers in your $N/L$ segments $S_i, i=0, \ldots, N/L-1$ (note: you've got a typo in your figure, if you start at 0, the number of the last segment is $N/L-1$, not $N/L$):

$$S_i = \sum_{k=i\cdot L}^{i\cdot (L+1)-1}\frac1L \lvert Z_k \rvert^2$$

Out of curiosity, let's consider the cdf of $\lvert Z_k \rvert^2$:

\begin{align} F_{\lvert Z_k \rvert^2}(v) &= P\left(\lvert Z_k \rvert^2 \le v\right)\\ &=\begin{cases} 0 & v < 0\\ P\left(\lvert Z_k \rvert \le \sqrt v \right) & v\ge 0 \end{cases}\\ &=\begin{cases} 0 & v < 0\\ P\left(-\sqrt z \le Z_k \le \sqrt v \right) & v\ge 0 \end{cases}\\ &=\begin{cases} 0 & v < 0\\ P\left( Z_k \le \sqrt v \right) -P\left( Z_k \le -\sqrt v \right) & v\ge 0 \end{cases}\\ &=\begin{cases} 0 & v < 0\\ F_{Z_k}\left( \sqrt v \right) - F_{Z_k}\left( -\sqrt v \right) & v\ge 0 \end{cases} \end{align}

with a mean $E\left(\lvert Z_k \rvert^2\right) > 0$ (a absolute square is always larger than zero, unless the original variable is 0, and I'd guess this is not a case you care about, because it means "noiseless"). With a little more derivation it's possible to show that the expectation of the random variable $\lvert Z_k\rvert^2$ is the variance of the random variable $Z_k$, i.e. the actual noise power $\sigma_Z^2$; the variance of $\lvert Z_k\rvert^2$ is twice that, at least for Gaussian $Z_k$.

Now, the cdf of that $S_i$ is simply:

\begin{align} F_{S_i}(p) &:= P(S_i \le p)\\ &=P\left(\sum_{k=i\cdot L}^{i\cdot (L+1)-1}\frac 1L \lvert Z_k \rvert^2 \le p \right)\\ S_i &\overset{\text{CLT}}\sim \mathcal N\left(E\left( \lvert Z_{iL} \rvert^2 \right); \frac 1L E\left(\left[\lvert Z_{iL} \rvert^2 - E\left(\lvert Z_{iL} \rvert^2\right)\right]^2\right) \right)\\ &= \mathcal N\left(\sigma_Z^2; \frac{2\sigma_Z^2}L\right) \end{align}

assuming that we can apply the central limit theorem (CLT), which says that for sufficiently large $L$, the sum over a random variable (such as $\lvert Z_k \rvert^2$) has a distribution that approaches the Normal distribution $\mathcal N(\mu_S;\sigma_S^2)$. The factor of $1/L$ in $\sigma_S^2$ stem from the linearity of the expectation (and the resultant quadratic influence of constant factors on variance).

Now, this just shows that your $S_i$ are just a bunch of approximately normal variables.

So, let us consider the minimum of these $S_i$,

$$M := \min_{i=1,\ldots, N/L-1} S_i,$$

which itself is a random variable.

Now, the cdf of that is pretty simple:

\begin{align} F_M(m) &:= P(M\le m)\\ &= P\left(\min_{i=1,\ldots, N/L-1} S_i \le m\right)\\ &= P\left(S_1 \le m \wedge S_2 \le m \wedge \ldots \wedge S_{L/N-1} \le m\right) \end{align}

Because we defined the noise to be independent, and thus especially between blocks, $P_1$, $P_2$ and so on are independent variables. Thus,

\begin{align} F_M(m) &= P\left(S_0 \le m \wedge S_1 \le m \wedge S_2 \le m \wedge \ldots \wedge S_{L/N-1} \le m\right)\\ &= P\left(S_0 \le m \right)P\left(S_1 \le m \right) P\left( S_2 \le m \right) \ldots P\left( S_{L/N-1} \le m\right)\\ &= P\left(S_0 \le m \right)^{N/L}\\ &= \left(F_{S_0}(m)\right)^{N/L}. \end{align}

We want to know what the expecation of $M$ is, because that's what we expect our noise power estimator estimates as noise power.

For that, we first find the pdf of $M$, and then just insert that into the definition of expectation.

\begin{align} f_M(m) &= \frac{\mathrm d\,}{\mathrm d\,m} F_M(m)\\ &= \frac NL \left( F_{S_0}(m)\right)^{N/L-1} \frac{\mathrm d\,}{\mathrm d\,m} F_{S_0}(m)\\ &= \frac NL \left( F_{S_0}(m)\right)^{N/L-1} f_{S_0}(m)\\ \end{align}

Normalizing $m$ allows us to use the cdf of the standardnormal distribution:

\begin{align} f_M(m) &= \frac NL \left( F_{S_0}(m)\right)^{N/L-1} f_{S_0}(m)\\ &= \frac NL \left( \Phi\left(\sqrt{\frac{L}{2}}\frac{m-\sigma_Z^2}{\sigma_Z}\right)\right)^{N/L-1} f_{S_0}(m)\\[2em] E(M) &= \int_{-\infty}^\infty m\cdot f_M(m) \,\mathrm dm \\ &= \int_{-\infty}^\infty m \left( \frac NL \left( F_{S_0}(m)\right)^{N/L-1} f_{S_0}(m) \right)\,\mathrm dm &|\text{ partial integr.} \end{align}

In the partial integration step we see that we indeed get a component that is the actual $\sigma_Z^2$, i.e. the actual noise power, but we subtract a strictly positive term. This bias means we're *systematically underestimating the noise power with what you call noise_power. This isn't a good estimator for noise power.

(There's a solution to the above integral; if you really want to know more, the $N/L$th power of a $\chi^2$-distributed variable involves a ratio of $\Gamma$ functions. Don't really think that result helps you much, but it proves (aside from the general consideration yielding the same) that you're underestimating noise power.)


But the thing that bothers me the most is the value of (signal_power+noise_power)/2 - as far as I can see, it's a simple arithmetic average of signal power and noise power. Is this how energy threshold is calculated?

No. Not in general, and I doubt it's a good choice here.

That threshold $\gamma$ needs to be chosen based on how much missed packets you can live with vs how much noise misidentified as packet you can accept. A common choice for a threshold would be one that leads to maximum likelihood estimation of whether there's a packet $D$ or only noise considering received segment power $S_i$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.