水平集高斯

时间:2016-03-31 22:20:30

标签: python numpy matplotlib scientific-computing

我想绘制这个2参数函数的级别集:

def xi_gaussian_x(x,y):
        sigma = 0.8
        mu = 1.2
        return (1.0/(sigma*np.sqrt(2*np.pi)))*(np.exp(-(x-mu)**2/(2*sigma**2)))

其中x和y介于-pi和pi之间。我的代码如下:

plt.ion()
xInterval = np.linspace(-np.pi,np.pi,num=1000)
yInterval = np.linspace(-np.pi,np.pi,num=1000)
levels_xi_gaussian_x=np.zeros((len(xInterval),len(yInterval)))
for i in range(len(xInterval)):
        for j in range(len(yInterval)):
              levels_xi_gaussian_x[i,j]=xi_gaussian_x(xInterval[i],yInterval[j])
plt.figure()
c = plt.contour(xInterval,yInterval,levels_xi_gaussian_x.T,50)

即使我增加了x和y间隔的分辨率,我仍然在-pi,pi平面中得到空的区域: enter image description here 如何让所有飞机都充满垂直线?

0 个答案:

没有答案