Algorithm Search⌘K

Definitioncore

Level crossing rate

Also called LCR, average fade duration.

The mean number of times per second that a fading envelope crosses a level going down. In Clarke's model it is sqrt(2 pi) f_D rho e^(-rho^2) at level rho relative to the RMS value.

The level crossing rate NRN_R of a fading channel is the mean number of times per second that the envelope ∣h(t)∣|h(t)| crosses a level RR in the downward direction. Together with the average fade duration tˉR\bar t_R, the mean time the envelope stays below RR after such a crossing, it describes how fades come in time: how often, and for how long. The two numbers are different quantities: NRN_R is a rate and tˉR\bar t_R is a time, and their product is the fraction of time spent below RR. In Clarke's model both have closed forms that go back to Rice's analysis of random noise: NR=2πfDρe−ρ2N_R = \sqrt{2\pi} f_D \rho e^{-\rho^2} at the level ρ\rho relative to the RMS envelope.

Definition

Crossings. Let r(t)=∣h(t)∣r(t) = |h(t)| be the envelope of a stationary fading process with mean power Ω=E[r2]\Omega = \mathbb{E}[r^2], and let R>0R > 0. A downward crossing of RR is a time t0t_0 at which r(t0)=Rr(t_0) = R and rr goes from above RR to below it. The level crossing rate is

NR=lim⁡T→∞number of downward crossings of R in [0,T]T,N_R = \lim_{T \to \infty} \frac{\text{number of downward crossings of } R \text{ in } [0, T]}{T},

which for a stationary ergodic process equals the expected number of downward crossings per second. It is usual to give the level in normalized form, ρ=R/Ω\rho = R/\sqrt\Omega, so that ρ=1\rho = 1 (0 dB) is the RMS value and ρ=0.1\rho = 0.1 is 2020 dB below it. A stationary process crosses upward as often as downward, so NRN_R also counts upward crossings.

Average fade duration. A fade below RR starts at a downward crossing and ends at the next upward crossing. Over a long time TT the envelope is below RR for a total of about TPr⁡[r<R]T \Pr[r < R] seconds, split into about NRTN_R T fades. So the average fade duration is

tˉR=Pr⁡[r<R]NR.\bar t_R = \frac{\Pr[r < R]}{N_R}.

Rice's formula (a theorem). If r(t)r(t) is differentiable and r(t)r(t) and its derivative r˙(t)\dot r(t) have a joint density p(r,r˙)p(r, \dot r), then

NR=∫0∞r˙ p(R,r˙) dr˙.N_R = \int_0^\infty \dot r\, p(R, \dot r)\, d\dot r.

The idea: in a short interval dtdt, a crossing upward happens when rr lies in (R−r˙ dt,R)(R - \dot r\, dt, R) with slope r˙>0\dot r > 0, an event of probability ∫0∞p(R,r˙) r˙ dt dr˙\int_0^\infty p(R, \dot r)\, \dot r\, dt\, d\dot r. Rice derived the rate of zeros of a Gaussian process this way and used the same joint statistics of a process and its derivative for the envelope (Rice 1944 and 1945).

Rayleigh fading with a symmetric Doppler spectrum (a closed form under these assumptions). Let h=hI+jhQh = h_I + j h_Q be a circular complex Gaussian process with mean power Ω\Omega and a Doppler spectrum that is even about 00, with RMS width σν\sigma_\nu. Then

NR=2π σν ρ e−ρ2,tˉR=eρ2−12π σν ρ.N_R = 2\sqrt\pi\, \sigma_\nu\, \rho\, e^{-\rho^2}, \qquad \bar t_R = \frac{e^{\rho^2} - 1}{2\sqrt\pi\, \sigma_\nu\, \rho}.

Proof. Each of hIh_I and hQh_Q has variance Ω/2\Omega/2 and autocorrelation rI(τ)r_I(\tau). Since the spectrum is even, hI(t)h_I(t), hQ(t)h_Q(t), h˙I(t)\dot h_I(t) and h˙Q(t)\dot h_Q(t) are uncorrelated at the same tt, so they are independent Gaussian variables. The derivatives have variance b=−rI′′(0)=(2π)2⋅Ω2σν2=2π2σν2Ωb = -r_I''(0) = (2\pi)^2 \cdot \frac{\Omega}{2}\sigma_\nu^2 = 2\pi^2\sigma_\nu^2\Omega. Write hI=rcos⁡ϕh_I = r\cos\phi and hQ=rsin⁡ϕh_Q = r\sin\phi. From r2=hI2+hQ2r^2 = h_I^2 + h_Q^2, r˙=h˙Icos⁡ϕ+h˙Qsin⁡ϕ\dot r = \dot h_I\cos\phi + \dot h_Q\sin\phi. Given (r,ϕ)(r, \phi), this is a sum of independent Gaussians with total variance b(cos⁡2ϕ+sin⁡2ϕ)=bb(\cos^2\phi + \sin^2\phi) = b. So r˙∼N(0,b)\dot r \sim \mathcal N(0, b), independent of rr, and p(R,r˙)=p(R) 12πbe−r˙2/(2b)p(R, \dot r) = p(R)\, \frac{1}{\sqrt{2\pi b}} e^{-\dot r^2/(2b)} with the Rayleigh density p(R)=2RΩe−R2/Ωp(R) = \frac{2R}{\Omega} e^{-R^2/\Omega}. Rice's formula gives

NR=p(R)∫0∞r˙2πbe−r˙2/(2b) dr˙=p(R)b2π=2ρe−ρ2Ω⋅πΩ σν=2π σν ρ e−ρ2.N_R = p(R) \int_0^\infty \frac{\dot r}{\sqrt{2\pi b}} e^{-\dot r^2/(2b)}\, d\dot r = p(R)\sqrt{\frac{b}{2\pi}} = \frac{2\rho e^{-\rho^2}}{\sqrt\Omega} \cdot \sqrt{\pi\Omega}\,\sigma_\nu = 2\sqrt\pi\,\sigma_\nu\,\rho\, e^{-\rho^2}.

With Pr⁡[r<R]=1−e−ρ2\Pr[r < R] = 1 - e^{-\rho^2}, the formula for tˉR\bar t_R follows. □\square

Clarke's model. The Clarke spectrum has σν=fD/2\sigma_\nu = f_D/\sqrt2, so

NR=2π fD ρ e−ρ2,tˉR=eρ2−1ρ fD2π.N_R = \sqrt{2\pi}\, f_D\, \rho\, e^{-\rho^2}, \qquad \bar t_R = \frac{e^{\rho^2} - 1}{\rho\, f_D \sqrt{2\pi}}.

These are the formulas of Jakes (1974) and of Goldsmith (Section 3.2.3), and they are closed forms under the assumptions of the model: isotropic scattering, no line of sight, a stationary process.

Properties. For Rayleigh fading with an even spectrum:

  1. Scaling. NRN_R is proportional to σν\sigma_\nu and tˉR\bar t_R to 1/σν1/\sigma_\nu. Doubling the speed doubles the rate of fades and halves their length.
  2. Most crossings at −3-3 dB. ρe−ρ2\rho e^{-\rho^2} is largest at ρ=1/2\rho = 1/\sqrt2. In Clarke's model the maximum rate is πe−1/2fD=1.0750fD\sqrt\pi e^{-1/2} f_D = 1.0750 f_D.
  3. Deep fades. For ρ≪1\rho \ll 1, NR≈2πfDρN_R \approx \sqrt{2\pi} f_D \rho and tˉR≈ρ/(fD2π)\bar t_R \approx \rho/(f_D\sqrt{2\pi}). Each 1010 dB lower level cuts the rate of fades by about 10=3.16\sqrt{10} = 3.16 and their length by the same factor, so the time spent below the level falls by 1010.
  4. Product. NR tˉR=Pr⁡[r<R]=1−e−ρ2N_R\, \bar t_R = \Pr[r < R] = 1 - e^{-\rho^2}, the outage probability at that level.

Examples and non-examples

Check values. In Clarke's model, at the level ρ=1\rho = 1: NR/fD=2π/e=0.92214N_R/f_D = \sqrt{2\pi}/e = 0.92214 and tˉRfD=(e−1)/2π=0.68550\bar t_R f_D = (e - 1)/\sqrt{2\pi} = 0.68550. Their product is 1−e−1=0.632121 - e^{-1} = 0.63212. More values:

level ρ\rho NR/fDN_R/f_D tˉRfD\bar t_R f_D Pr⁡[r<R]\Pr[r < R]
00 dB 11 0.922140.92214 0.685500.68550 0.63210.6321
−3-3 dB 0.707110.70711 1.075051.07505 0.366000.36600 0.39350.3935
−10-10 dB 0.316230.31623 0.717230.71723 0.132680.13268 0.09520.0952
−20-20 dB 0.10.1 0.248170.24817 0.040090.04009 0.009950.00995
−30-30 dB 0.031620.03162 0.079190.07919 0.012620.01262 0.001000.00100

A car at 108 km/h. At v=30v = 30 m/s and fc=900f_c = 900 MHz, fD=90.06f_D = 90.06 Hz. The envelope falls below its RMS value 83.083.0 times per second, for 7.617.61 ms on average. It falls 1010 dB below 64.664.6 times per second for 1.471.47 ms, and 2020 dB below 22.422.4 times per second for 0.4450.445 ms. At 270270 kbit/s, a 2020 dB fade spans about 120120 bits, so a code needs an interleaver deeper than that.

A walker. At 33 km/h and 2.42.4 GHz, fD=6.67f_D = 6.67 Hz. Fades 1010 dB deep come 4.84.8 times per second and last 19.919.9 ms each. These are much longer than at vehicle speeds, which is why slow terminals suffer from long bursts of errors.

Estimating from a sample path. On a sampled envelope r[k]=r(kΔt)r[k] = r(k\Delta t), count the kk with r[k−1]≥R>r[k]r[k-1] \ge R > r[k] and divide by the length of the record; divide the time below RR by that count to get tˉR\bar t_R. The sampling interval must be well below tˉR\bar t_R, or short fades fall between samples.

  1. LCR-AFD(ρ, f_D) ▷ Clarke's model, ρ = R / √Ω
  2. 1N ← √(2π) · f_D · ρ · e^(-ρ²)
  3. 2P ← 1 - e^(-ρ²) ▷ Pr[r < R] for a Rayleigh envelope
  4. 3return N, P / N
  5. COUNT-CROSSINGS(r[0..n-1], R, Δt) ▷ estimates from a sampled envelope
  6. 4c ← number of k in 1..n-1 with r[k-1] ≥ R > r[k]
  7. 5b ← number of k in 0..n-1 with r[k] < R
  8. 6return c / (n Δt), (b · Δt) / c

The implementation follows this outline. Its tests check the table above and the proof's general formula, and they count crossings on sample paths made by summing 3232 sinusoids with random angles and phases, a method close to the Zheng and Xiao simulator. The counts agree with the closed forms within a stated tolerance, not exactly, because such a sum is only close to Gaussian.

Non-example: block fading. A block fading model holds hh fixed over a block and redraws it at the next one. The envelope jumps at the block edges and is not differentiable, so Rice's formula does not apply. The number of crossings per second depends on the block length, not on any Doppler spectrum.

Non-example: the coherence time. The coherence time is a lag at which the correlation of hh falls to a set value. It does not depend on a level. tˉR\bar t_R does: in Clarke's model, fades below −20-20 dB last 0.040/fD0.040/f_D, and the coherence time at correlation 0.50.5 is 0.242/fD0.242/f_D.

Non-example: the rate of the power. The power ∣h∣2|h|^2 crosses R2R^2 exactly when ∣h∣|h| crosses RR, so it has the same crossing rate at the matching level. Quoting NRN_R against a level in dB of power and a level in dB of amplitude gives the same table only because 20log⁡10ρ=10log⁡10ρ220\log_{10}\rho = 10\log_{10}\rho^2.

  • Clarke model: the model behind the closed forms on this page.
  • Rayleigh fading channel: the first-order distribution Pr⁡[r<R]=1−e−ρ2\Pr[r < R] = 1 - e^{-\rho^2}.
  • Doppler spread: σν\sigma_\nu, which sets the scale of NRN_R.
  • Outage probability: the fraction of time below a level, equal to NR tˉRN_R\, \bar t_R.
  • Gilbert-Elliott channel: a two-state model of good and bad periods whose transition rates can be fitted to NRN_R and tˉR\bar t_R.
  • Jakes fading simulator: a generator whose crossing rate is a common test.

Code

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

level_crossing_rate.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/level-crossing-rate/. The authors are listed in prov/Y8DDW4.jsonl.

"""Level crossing rate and average fade duration of a fading envelope.

rho = R / sqrt(Omega) is the level relative to the RMS envelope, f_d the maximum Doppler
frequency in Hz (Clarke's model) and sigma_nu the RMS Doppler spread in Hz (any even spectrum).
"""

import math
from typing import Sequence, Tuple


def lcr_afd_clarke(rho: float, f_d: float) -> Tuple[float, float]:
    """(N_R, t_R) in Clarke's model: crossings per second and mean fade length in seconds."""
    if rho <= 0 or f_d <= 0:
        raise ValueError("rho and f_d must be positive")
    n = math.sqrt(2 * math.pi) * f_d * rho * math.exp(-rho * rho)  # @line L1
    p = -math.expm1(-rho * rho)  # @line L2
    return n, p / n  # @line L3


def lcr_afd_rayleigh(rho: float, sigma_nu: float) -> Tuple[float, float]:
    """(N_R, t_R) for Rayleigh fading with an even Doppler spectrum of RMS width sigma_nu."""
    if rho <= 0 or sigma_nu <= 0:
        raise ValueError("rho and sigma_nu must be positive")
    n = 2 * math.sqrt(math.pi) * sigma_nu * rho * math.exp(-rho * rho)
    return n, -math.expm1(-rho * rho) / n


def count_crossings(r: Sequence[float], level: float, dt: float) -> Tuple[float, float]:
    """Estimates (N_R, t_R) from envelope samples r[k] = r(k dt)."""
    n = len(r)
    if n < 2 or dt <= 0:
        raise ValueError("need at least two samples and dt > 0")
    c = sum(1 for k in range(1, n) if r[k - 1] >= level > r[k])  # @line L4
    b = sum(1 for x in r if x < level)  # @line L5
    if c == 0:
        return 0.0, math.inf
    return c / (n * dt), b * dt / c  # @line L6
test_level_crossing_rate.py 91 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/level-crossing-rate/. The authors are listed in prov/Y8DDW4.jsonl.

import cmath
import math
import random

from level_crossing_rate import count_crossings, lcr_afd_clarke, lcr_afd_rayleigh


def test_check_values() -> None:
    n, t = lcr_afd_clarke(1.0, 1.0)
    assert abs(n - 0.92214) < 5e-6 and abs(t - 0.68550) < 5e-6
    assert abs(n * t - (1 - math.exp(-1))) < 1e-15
    table = [
        (1 / math.sqrt(2), 1.07505, 0.36600),
        (10 ** (-10 / 20), 0.71723, 0.13268),
        (0.1, 0.24817, 0.04009),
        (10 ** (-30 / 20), 0.07919, 0.01262),
    ]
    for rho, nr, tr in table:
        n, t = lcr_afd_clarke(rho, 1.0)
        assert abs(n - nr) < 5e-6 and abs(t - tr) < 5e-6


def test_example_numbers() -> None:
    fd = 30 * 900e6 / 299_792_458.0
    n, t = lcr_afd_clarke(1.0, fd)
    assert abs(n - 83.05) < 0.01 and abs(t * 1e3 - 7.611) < 1e-3
    n, t = lcr_afd_clarke(0.1, fd)
    assert abs(n - 22.35) < 0.01 and abs(t * 1e3 - 0.4452) < 1e-4
    fd = (3 / 3.6) * 2.4e9 / 299_792_458.0
    n, t = lcr_afd_clarke(10 ** (-0.5), fd)
    assert abs(n - 4.785) < 1e-3 and abs(t * 1e3 - 19.89) < 0.01


def test_scaling_and_maximum() -> None:
    for rho in (0.05, 0.3, 1.0, 1.7):
        n1, t1 = lcr_afd_clarke(rho, 10.0)
        n2, t2 = lcr_afd_clarke(rho, 20.0)
        assert abs(n2 - 2 * n1) < 1e-12 and abs(t2 - t1 / 2) < 1e-15
        # Clarke is the general formula with sigma_nu = f_D / sqrt(2).
        ng, tg = lcr_afd_rayleigh(rho, 10.0 / math.sqrt(2))
        assert abs(ng - n1) < 1e-12 and abs(tg - t1) < 1e-15
    grid = [i / 10000 for i in range(1, 30000)]
    best = max(grid, key=lambda r: lcr_afd_clarke(r, 1.0)[0])
    assert abs(best - 1 / math.sqrt(2)) < 2e-4
    assert abs(lcr_afd_clarke(1 / math.sqrt(2), 1.0)[0] - math.sqrt(math.pi) * math.exp(-0.5)) < 1e-15


def envelope_path(rng: random.Random, m: int, fd: float, dt: float, n: int) -> list:
    """|h(k dt)| for h = sum of m sinusoids with random angles and phases, power 1."""
    amp = 1 / math.sqrt(m)
    z = [amp * cmath.exp(1j * rng.uniform(0, 2 * math.pi)) for _ in range(m)]
    w = [cmath.exp(2j * math.pi * fd * math.cos(rng.uniform(0, 2 * math.pi)) * dt) for _ in range(m)]
    out = []
    for _ in range(n):
        out.append(abs(sum(z)))
        z = [a * b for a, b in zip(z, w)]
    return out


def test_counts_on_sample_paths() -> None:
    # Tolerance 10%: a sum of 32 sinusoids is close to, not exactly, a Gaussian process.
    rng = random.Random(11)
    fd, dt, n, reps = 1.0, 0.01, 8000, 16
    paths = [envelope_path(rng, 32, fd, dt, n) for _ in range(reps)]
    for rho in (1.0, 10 ** (-10 / 20)):
        crossings = below = 0
        for r in paths:
            nr, tr = count_crossings(r, rho, dt)
            crossings += round(nr * n * dt)
            below += sum(1 for x in r if x < rho)
        est_n = crossings / (reps * n * dt)
        est_t = below * dt / crossings
        exact_n, exact_t = lcr_afd_clarke(rho, fd)
        assert abs(est_n / exact_n - 1) < 0.10
        assert abs(est_t / exact_t - 1) < 0.10


def test_count_small_cases() -> None:
    r = [2.0, 0.5, 2.0, 0.5, 0.5, 2.0]
    n, t = count_crossings(r, 1.0, 0.5)
    assert n == 2 / 3 and t == 0.75
    assert count_crossings([2.0, 2.0], 1.0, 1.0) == (0.0, math.inf)
    for bad in ((0.0, 1.0), (1.0, 0.0)):
        try:
            lcr_afd_clarke(*bad)
        except ValueError:
            continue
        raise AssertionError("expected ValueError")

References

  1. S. O. Rice, Mathematical analysis of random noise, Bell System Technical Journal 23(3), 1944, pp. 282 to 332 (Parts I and II, shot noise, power spectra and correlation functions)
  2. S. O. Rice, Mathematical analysis of random noise (concluded), Bell System Technical Journal 24(1), 1945, pp. 46 to 156 (Part III, statistical properties of random noise, with Section 3.3 on the expected number of zeros per second)
  3. William C. Jakes (editor), Microwave Mobile Communications, Wiley, 1974; reissued by IEEE Press, 1994, the chapter on multipath interference (the level crossing rate and the duration of fades of the Rayleigh envelope under uniform angles of arrival)
  4. Andrea Goldsmith, Wireless Communications, Cambridge University Press, 2005, Section 3.2.3 (level crossing rate and average fade duration, equation 3.44)
  5. Theodore S. Rappaport, Wireless Communications, Principles and Practice, second edition, Prentice Hall, 2002, Section 5.7.3 (level crossing and fading statistics)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/Y8DDW4/text.yaml