Bivariate Gaussian
From neurov.is/on
The bivariate Gaussian can be written as:
where ρ is the correlation between X and Y. In other words
[edit] From Wikipedia
In two-dimensions, one can vary a Gaussian in more parameters: not only may one vary a single width, but one may vary two separate widths, and rotate: one thus obtains both circular Gaussians and elliptical Gaussians, accordingly as the level sets are circles or ellipses.
A particular example of a two-dimensional Gaussian function is
Here the coefficient A is the amplitude, xo,yo is the center and σx, σy are the x and y spreads of the blob. The figure on the right was created using A = 1, xo = 0, yo = 0, σx = σy = 1.
In general, a two-dimensional elliptical Gaussian function is expressed as
where the matrix
Using this formulation, the figure on the right can be created using A = 1, (xo, yo) = (0, 0), a = c = 1/2, b = 0.
[edit] Meaning of parameters for the general equation
For the general form of the equation the coefficient A is the height of the peak and (xo, yo) is the center of the blob.
If we set
then we rotate the blob by an angle θ. This can be seen in the following examples:
| File:Gaussian 2d 1.png θ = 0 |
File:Gaussian 2d 2.png θ = π / 6 |
File:Gaussian 2d 3.png θ = π / 3 |
Using the following MATLAB code one can see the effect of changing the parameters easily
A = 1; x0 = 0; y0 = 0; sigma_x = 1; sigma_y = 2; 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; [X, Y] = meshgrid(-5:.1:5, -5:.1:5); 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);axis equal;drawnow end
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.