Discretization

From HandWiki
Revision as of 18:13, 6 February 2024 by imported>JStaso (fixing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Process of transferring continuous functions into discrete counterparts
A solution to a discretized partial differential equation, obtained with the finite element method.

In applied mathematics, discretization is the process of transferring continuous functions, models, variables, and equations into discrete counterparts. This process is usually carried out as a first step toward making them suitable for numerical evaluation and implementation on digital computers. Dichotomization is the special case of discretization in which the number of discrete classes is 2, which can approximate a continuous variable as a binary variable (creating a dichotomy for modeling purposes, as in binary classification).

Discretization is also related to discrete mathematics, and is an important component of granular computing. In this context, discretization may also refer to modification of variable or category granularity, as when multiple discrete variables are aggregated or multiple discrete categories fused.

Whenever continuous data is discretized, there is always some amount of discretization error. The goal is to reduce the amount to a level considered negligible for the modeling purposes at hand.

The terms discretization and quantization often have the same denotation but not always identical connotations. (Specifically, the two terms share a semantic field.) The same is true of discretization error and quantization error.

Mathematical methods relating to discretization include the Euler–Maruyama method and the zero-order hold.

Discretization of linear state space models

Discretization is also concerned with the transformation of continuous differential equations into discrete difference equations, suitable for numerical computing.

The following continuous-time state space model

𝐱˙(t)=𝐀𝐱(t)+𝐁𝐮(t)+𝐰(t)
𝐲(t)=𝐂𝐱(t)+𝐃𝐮(t)+𝐯(t)

where v and w are continuous zero-mean white noise sources with power spectral densities

𝐰(t)N(0,𝐐)
𝐯(t)N(0,𝐑)

can be discretized, assuming zero-order hold for the input u and continuous integration for the noise v, to

𝐱[k+1]=𝐀d𝐱[k]+𝐁d𝐮[k]+𝐰[k]
𝐲[k]=𝐂d𝐱[k]+𝐃d𝐮[k]+𝐯[k]

with covariances

𝐰[k]N(0,𝐐d)
𝐯[k]N(0,𝐑d)

where

𝐀d=e𝐀T=1{(s𝐈𝐀)1}t=T
𝐁d=(τ=0Te𝐀τdτ)𝐁=𝐀1(𝐀dI)𝐁, if 𝐀 is nonsingular
𝐂d=𝐂
𝐃d=𝐃
𝐐d=τ=0Te𝐀τ𝐐e𝐀τdτ
𝐑d=𝐑1T

and T is the sample time, although 𝐀 is the transposed matrix of 𝐀. The equation for the discretized measurement noise is a consequence of the continuous measurement noise being defined with a power spectral density.[1]

A clever trick to compute Ad and Bd in one step is by utilizing the following property:[2]:p. 215

e[𝐀𝐁𝟎𝟎]T=[A𝐝B𝐝𝟎𝐈]

Where 𝐀dand 𝐁dare the discretized state-space matrices.

Discretization of process noise

Numerical evaluation of 𝐐d is a bit trickier due to the matrix exponential integral. It can, however, be computed by first constructing a matrix, and computing the exponential of it[3]

𝐅=[𝐀𝐐𝟎𝐀]T
𝐆=e𝐅=[𝐀d1𝐐d𝟎𝐀d].

The discretized process noise is then evaluated by multiplying the transpose of the lower-right partition of G with the upper-right partition of G:

𝐐d=(𝐀d)(𝐀d1𝐐d)=𝐀d(𝐀d1𝐐d).

Derivation

Starting with the continuous model

x˙(t)=𝐀𝐱(t)+𝐁𝐮(t)

we know that the matrix exponential is

ddte𝐀t=𝐀e𝐀t=e𝐀t𝐀

and by premultiplying the model we get

e𝐀tx˙(t)=e𝐀t𝐀𝐱(t)+e𝐀t𝐁𝐮(t)

which we recognize as

ddt(e𝐀t𝐱(t))=e𝐀t𝐁𝐮(t)

and by integrating..

e𝐀t𝐱(t)e0𝐱(0)=0te𝐀τ𝐁𝐮(τ)dτ
𝐱(t)=e𝐀t𝐱(0)+0te𝐀(tτ)𝐁𝐮(τ)dτ

which is an analytical solution to the continuous model.

Now we want to discretise the above expression. We assume that u is constant during each timestep.

𝐱[k] =def 𝐱(kT)
𝐱[k]=e𝐀kT𝐱(0)+0kTe𝐀(kTτ)𝐁𝐮(τ)dτ
𝐱[k+1]=e𝐀(k+1)T𝐱(0)+0(k+1)Te𝐀((k+1)Tτ)𝐁𝐮(τ)dτ
𝐱[k+1]=e𝐀T[e𝐀kT𝐱(0)+0kTe𝐀(kTτ)𝐁𝐮(τ)dτ]+kT(k+1)Te𝐀(kT+Tτ)𝐁𝐮(τ)dτ

We recognize the bracketed expression as 𝐱[k], and the second term can be simplified by substituting with the function v(τ)=kT+Tτ. Note that dτ=dv. We also assume that 𝐮 is constant during the integral, which in turn yields

𝐱[k+1]=e𝐀T𝐱[k](v(kT)v((k+1)T)e𝐀vdv)𝐁𝐮[k]=e𝐀T𝐱[k](T0e𝐀vdv)𝐁𝐮[k]=e𝐀T𝐱[k]+(0Te𝐀vdv)𝐁𝐮[k]=e𝐀T𝐱[k]+𝐀1(e𝐀T𝐈)𝐁𝐮[k]

which is an exact solution to the discretization problem.

When 𝐀 is singular, the latter expression can still be used by replacing e𝐀T by its Taylor expansion,

e𝐀T=k=01k!(𝐀T)k.

This yields

𝐱[k+1]=e𝐀T𝐱[k]+(0Te𝐀vdv)𝐁𝐮[k]=(k=01k!(𝐀T)k)𝐱[k]+(k=11k!𝐀k1Tk)𝐁𝐮[k],

which is the form used in practice.

Approximations

Exact discretization may sometimes be intractable due to the heavy matrix exponential and integral operations involved. It is much easier to calculate an approximate discrete model, based on that for small timesteps e𝐀T𝐈+𝐀T. The approximate solution then becomes:

𝐱[k+1](𝐈+𝐀T)𝐱[k]+T𝐁𝐮[k]

This is also known as the Euler method, which is also known as the forward Euler method. Other possible approximations are e𝐀T(𝐈𝐀T)1, otherwise known as the backward Euler method and e𝐀T(𝐈+12𝐀T)(𝐈12𝐀T)1, which is known as the bilinear transform, or Tustin transform. Each of these approximations has different stability properties. The bilinear transform preserves the instability of the continuous-time system.

Discretization of continuous features

Main page: Discretization of continuous features

In statistics and machine learning, discretization refers to the process of converting continuous features or variables to discretized or nominal features. This can be useful when creating probability mass functions.

Discretization of smooth functions

In generalized functions theory, discretization arises as a particular case of the Convolution Theorem on tempered distributions

{f*III}={f}III
{αIII}={α}*III

where III is the Dirac comb, III is discretization, *III is periodization, f is a rapidly decreasing tempered distribution (e.g. a Dirac delta function δ or any other compactly supported function), α is a smooth, slowly growing ordinary function (e.g. the function that is constantly 1 or any other band-limited function) and is the (unitary, ordinary frequency) Fourier transform. Functions α which are not smooth can be made smooth using a mollifier prior to discretization.

As an example, discretization of the function that is constantly 1 yields the sequence [..,1,1,1,..] which, interpreted as the coefficients of a linear combination of Dirac delta functions, forms a Dirac comb. If additionally truncation is applied, one obtains finite sequences, e.g. [1,1,1,1]. They are discrete in both, time and frequency.

See also

References

  1. Analytic Sciences Corporation. Technical Staff. (1974). Applied optimal estimation.. Gelb, Arthur, 1937-. Cambridge, Mass.: M.I.T. Press. pp. 121. ISBN 0-262-20027-9. OCLC 960061. https://archive.org/details/appliedoptimales00agel. 
  2. Raymond DeCarlo: Linear Systems: A State Variable Approach with Numerical Implementation, Prentice Hall, NJ, 1989
  3. Charles Van Loan: Computing integrals involving the matrix exponential, IEEE Transactions on Automatic Control. 23 (3): 395–404, 1978

Further reading