dx = (xmax - xmin) / steps dy = (ymax - ymin) / steps # grid size cartesian range if OPT_3D_POLAR_SPEC == True: # polar grid [r, phi] = np.meshgrid(np.arange(rmin, rmax, dr), np.arange(0, 2 * pi, dphi)) # [x, y] = np.pol2cart(phi,r) # x = r * cos(phi) y = r * sin(phi) else: # cartesian grid [x, y] = np.meshgrid(np.arange(xmin, xmax, dx), np.arange(ymin, ymax, dy)) z = x + 1j * y # create coordinate grid for complex plane phi_EK = np.linspace(0, 2 * pi, 400) # 400 points from 0 ... 2 pi xy_EK = np.exp(1j * phi_EK) # x,y coordinates of unity circle H_EK = dsp.H_mag(bb, aa, xy_EK, thresh) #|H(jw)| along the unity circle Hmag = dsp.H_mag(bb, aa, z, thresh) #|H(z)| #=============================================================== ## 3D-Plot of |H(f)| - linear scale #=============================================================== if SHOW_3D_LIN_H_F == True: fig = plt.figure(10) ax10 = fig.gca(projection='3d') #plot ||H(f)| along unit circle as line plt.plot(xy_EK.real, xy_EK.imag, H_EK, linewidth=2) # Plot unit circle: plt.plot(xy_EK.real, xy_EK.imag, zeros(len(xy_EK)), linewidth=2, color='k') ax10.plot(nulls.real, nulls.imag, np.ones(len(nulls)) * H_max * 0.1,
dx = (xmax - xmin) / steps dy = (ymax - ymin) / steps # grid size cartesian range if OPT_3D_POLAR_SPEC == True: # polar grid [r, phi] = np.meshgrid(np.arange(rmin, rmax, dr), np.arange(0,2*pi,dphi)) # [x, y] = np.pol2cart(phi,r) # x = r * cos(phi); y = r * sin(phi) else: # cartesian grid [x, y] = np.meshgrid(np.arange(xmin,xmax,dx), np.arange(ymin,ymax,dy)) z = x + 1j*y # create coordinate grid for complex plane phi_EK = np.linspace(0,2*pi,400) # 400 points from 0 ... 2 pi xy_EK = np.exp(1j * phi_EK) # x,y coordinates of unity circle H_EK = dsp.H_mag(bb, aa, xy_EK, thresh) #|H(jw)| along the unity circle Hmag = dsp.H_mag(bb, aa, z,thresh) #|H(z)| #=============================================================== ## 3D-Plot of |H(f)| - linear scale #=============================================================== if SHOW_3D_LIN_H_F == True: fig = plt.figure(10) ax10 = fig.gca(projection='3d') #plot ||H(f)| along unit circle as line plt.plot(xy_EK.real, xy_EK.imag, H_EK, linewidth=2) # Plot unit circle: plt.plot(xy_EK.real, xy_EK.imag, zeros(len(xy_EK)), linewidth=2, color = 'k') ax10.plot(nulls.real, nulls.imag, np.ones(len(nulls)) * H_max * 0.1 , 'o', markersize = PN_SIZE, markeredgecolor='blue', markeredgewidth=2.0,
x = xm.T y = ym.T #x, y = np.mgrid[xmin:xmax:steps*1j, ymin:ymax:steps*1j] #xc = x[:,0] yc = y[0,:] s = x + 1j*y # complex coordinate grid fig5 = plt.figure(5) ax12 = fig5.add_subplot(111,projection='3d') #colormap gray; #hsv / gray / default / colorcube / bone / summer / autumn #extents=(-1,1, -1,1, -1,1) if OPT_3D_PLOT_TYPE == 'MESH': g=ax12.plot_wireframe(x,y,dsp.H_mag(bb,aa,s,thresh),rstride=2, cstride=2, linewidth = 1, color = 'gray') #plot 3D-mesh of |H(z)| ; limit at |H(z)| = thresh elif OPT_3D_PLOT_TYPE == 'MESH_MLAB': mlab.mesh(x, y, dsp.H_mag(bb,aa,s,thresh), colormap="bone") elif OPT_3D_PLOT_TYPE == 'SURF_MLAB': # x, y = np.mgrid[-7.:7.05:0.1, -5.:5.05:0.05] # s = np.sin(x+y) + np.sin(2*x - y) + np.cos(3*x+4*y) fm1 = mlab.figure() p1 = mlab.plot3d(zeros(len(yc)), yc, dsp.H_mag(bb,aa,1j*yc*2*pi,thresh)*z_scale, color = (0,0,0)) #extent = (0, 0,ymin, ymax,0,thresh) s = mlab.surf(x, y, dsp.H_mag(bb,aa,s,thresh), warp_scale = z_scale) #extent = (xmin, xmax,ymin, ymax,0,thresh) mlab.axes(z_axis_visibility = False)
#x, y = np.mgrid[xmin:xmax:steps*1j, ymin:ymax:steps*1j] #xc = x[:,0] yc = y[0, :] s = x + 1j * y # complex coordinate grid fig5 = plt.figure(5) ax12 = fig5.add_subplot(111, projection='3d') #colormap gray; #hsv / gray / default / colorcube / bone / summer / autumn #extents=(-1,1, -1,1, -1,1) if OPT_3D_PLOT_TYPE == 'MESH': g = ax12.plot_wireframe(x, y, dsp.H_mag(bb, aa, s, thresh), rstride=2, cstride=2, linewidth=1, color='gray') #plot 3D-mesh of |H(z)| ; limit at |H(z)| = thresh elif OPT_3D_PLOT_TYPE == 'MESH_MLAB': mlab.mesh(x, y, dsp.H_mag(bb, aa, s, thresh), colormap="bone") elif OPT_3D_PLOT_TYPE == 'SURF_MLAB': # x, y = np.mgrid[-7.:7.05:0.1, -5.:5.05:0.05] # s = np.sin(x+y) + np.sin(2*x - y) + np.cos(3*x+4*y) fm1 = mlab.figure() p1 = mlab.plot3d(zeros(len(yc)), yc, dsp.H_mag(bb, aa, 1j * yc * 2 * pi, thresh) * z_scale,