Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Gaussian function
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Two-dimensional Gaussian function == [[File:Gaussian 2d surface.png|thumb|3d plot of a Gaussian function with a two-dimensional domain]] Base form: <math display="block">f(x,y) = \exp(-x^2-y^2)</math> In two dimensions, the power to which ''e'' is raised in the Gaussian function is any negative-definite quadratic form. Consequently, the [[level set]]s of the Gaussian will always be ellipses. A particular example of a two-dimensional Gaussian function is <!-- This makes the formula consistent with the 1d formula above --> <math display="block">f(x,y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2} + \frac{(y - y_0)^2}{2\sigma_Y^2} \right)\right).</math> Here the coefficient ''A'' is the amplitude, ''x''<sub>0</sub>, ''y''<sub>0</sub> is the center, and ''σ''<sub>''x''</sub>, ''σ''<sub>''y''</sub> are the ''x'' and ''y'' spreads of the blob. The figure on the right was created using ''A'' = 1, ''x''<sub>0</sub> = 0, ''y''<sub>0</sub> = 0, ''σ''<sub>''x''</sub> = ''σ''<sub>''y''</sub> = 1. The volume under the Gaussian function is given by <math display="block">V = \int_{-\infty}^\infty \int_{-\infty}^\infty f(x, y)\,dx \,dy = 2 \pi A \sigma_X \sigma_Y.</math> In general, a two-dimensional elliptical Gaussian function is expressed as <math display="block">f(x, y) = A \exp\Big(-\big(a(x - x_0)^2 + 2b(x - x_0)(y - y_0) + c(y - y_0)^2 \big)\Big),</math> where the matrix <math display="block">\begin{bmatrix} a & b \\ b & c \end{bmatrix}</math> is [[positive-definite matrix|positive-definite]]. Using this formulation, the figure on the right can be created using {{math|1=''A'' = 1}}, {{math|1=(''x''<sub>0</sub>, ''y''<sub>0</sub>) = (0, 0)}}, {{math|1=''a'' = ''c'' = 1/2}}, {{math|1=''b'' = 0}}. === Meaning of parameters for the general equation === For the general form of the equation the coefficient ''A'' is the height of the peak and {{math|(''x''<sub>0</sub>, ''y''<sub>0</sub>)}} is the center of the blob. If we set <math display="block"> \begin{align} a &= \frac{\cos^2\theta}{2\sigma_X^2} + \frac{\sin^2\theta}{2\sigma_Y^2}, \\ b &= -\frac{\sin \theta \cos \theta}{2\sigma_X^2} + \frac{\sin \theta \cos \theta}{2\sigma_Y^2}, \\ c &= \frac{\sin^2\theta}{2\sigma_X^2} + \frac{\cos^2\theta}{2\sigma_Y^2}, \end{align} </math>then we rotate the blob by a positive, counter-clockwise angle <math>\theta</math> (for negative, clockwise rotation, invert the signs in the ''b'' coefficient).<ref>{{cite web |last1=Nawri |first1=Nikolai |title=Berechnung von Kovarianzellipsen |url=http://imkbemu.physik.uni-karlsruhe.de/~eisatlas/covariance_ellipses.pdf |access-date=14 August 2019 |url-status=dead |archive-url=https://web.archive.org/web/20190814081830/http://imkbemu.physik.uni-karlsruhe.de/~eisatlas/covariance_ellipses.pdf |archive-date=2019-08-14}}</ref> To get back the coefficients <math>\theta</math>, <math>\sigma_X</math> and <math>\sigma_Y</math> from <math>a</math>, <math>b</math> and <math>c</math> use <math display="block">\begin{align} \theta &= \frac{1}{2}\arctan\left(\frac{2b}{a-c}\right), \quad \theta \in [-45, 45], \\ \sigma_X^2 &= \frac{1}{2 (a \cdot \cos^2\theta + 2 b \cdot \cos\theta\sin\theta + c \cdot \sin^2\theta)}, \\ \sigma_Y^2 &= \frac{1}{2 (a \cdot \sin^2\theta - 2 b \cdot \cos\theta\sin\theta + c \cdot \cos^2\theta)}. \end{align}</math> Example rotations of Gaussian blobs can be seen in the following examples: {| | [[Image:Gaussian 2d 0 degrees.png|thumb|200px|<math>\theta = 0</math>]] | [[Image:Gaussian 2d 30 degrees.png|thumb|200px|<math>\theta = -\pi/6</math>]] | [[Image:Gaussian 2d 60 degrees.png|thumb|200px|<math>\theta = -\pi/3</math>]] |} Using the following [[GNU Octave|Octave]] code, one can easily see the effect of changing the parameters: <syntaxhighlight lang="octave"> A = 1; x0 = 0; y0 = 0; sigma_X = 1; sigma_Y = 2; [X, Y] = meshgrid(-5:.1:5, -5:.1:5); for theta = 0:pi/100:pi a = cos(theta)^2 / (2 * sigma_X^2) + sin(theta)^2 / (2 * sigma_Y^2); b = sin(2 * theta) / (4 * sigma_X^2) - sin(2 * theta) / (4 * sigma_Y^2); c = sin(theta)^2 / (2 * sigma_X^2) + cos(theta)^2 / (2 * sigma_Y^2); Z = A * exp(-(a * (X - x0).^2 + 2 * b * (X - x0) .* (Y - y0) + c * (Y - y0).^2)); surf(X, Y, Z); shading interp; view(-36, 36) waitforbuttonpress end </syntaxhighlight> Such functions are often used in [[image processing]] and in computational models of [[visual system]] function—see the articles on [[scale space]] and [[affine shape adaptation]]. Also see [[multivariate normal distribution]]. === Higher-order Gaussian or super-Gaussian function or generalized Gaussian function === A more general formulation of a Gaussian function with a flat-top and Gaussian fall-off can be taken by raising the content of the exponent to a power <math>P</math>: <math display="block">f(x) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2}\right)^P\right).</math> This function is known as a super-Gaussian function and is often used for Gaussian beam formulation.<ref>Parent, A., M. Morin, and P. Lavigne. "Propagation of super-Gaussian field distributions". ''[[Optical and Quantum Electronics]]'' 24.9 (1992): S1071–S1079.</ref> This function may also be expressed in terms of the [[full width at half maximum]] (FWHM), represented by {{mvar|w}}: <math display="block">f(x) = A \exp\left(-\ln 2\left(4\frac{(x - x_0)^2}{w^2}\right)^P\right).</math> In a two-dimensional formulation, a Gaussian function along <math>x</math> and <math>y</math> can be combined<ref>{{Cite web |url=http://www.aor.com/anonymous/pub/commands.pdf |title=GLAD optical software commands manual, Entry on GAUSSIAN command |date=2016-12-15 |website=Applied Optics Research}}</ref> with potentially different <math>P_X</math> and <math>P_Y</math> to form a rectangular Gaussian distribution: <math display="block">f(x, y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2}\right)^{P_X} - \left(\frac{(y - y_0)^2}{2\sigma_Y^2}\right)^{P_Y}\right).</math> or an elliptical Gaussian distribution: <math display="block">f(x , y) = A \exp\left(-\left(\frac{(x - x_0)^2}{2\sigma_X^2} + \frac{(y - y_0)^2}{2\sigma_Y^2}\right)^P\right)</math>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)