Answers for "2d gaussian function python"

0

2d gaussian function python

import numpy as np

grid_x, grid_y = np.mgrid[-2:2:50j, -2:2:50j]
A = 1 # Gaussian height
x_0, y_0 = 0, 0 # Gaussian centers
sigma_x, sigma_y = 0.5, 0.5

gaussian_2D = A * np.exp(-(((grid_x - x_0)**2 / (2 * sigma_x**2)) + ((grid_y - y_0)**2 / (2 * sigma_y**2))))
Posted by: Guest on March-11-2022

Python Answers by Framework

Browse Popular Code Answers by Language