프로그래밍 언어/Matlab

[Matlab] Gaussian Distribution

바보1 2022. 10. 14. 18:52

\(G(x, y) = \frac{1}{2\pi\sigma_x\sigma_y} \exp^{-(\frac{x^2}{2\sigma^2_x} + \frac{y^2}{2\sigma^2_y})}\)

function gaussian(sigma_x, sigma_y)
x = -4:0.1:4;
y = -4:0.1:4;
[x, y] = meshgrid(x, y);
z = exp(-(x.^2 / 2 * sigma_x^2 + y.^2 / 2 * sigma_y^2)) / (2 * pi * sigma_x * sigma_y);
mesh(x, y, z)
end

x축, y축 표준편차가 각각 1, 1

 

x축, y축 표준편차가 각각 1/2, 1/2
x축, y축 표준편차가 각각 1, 2