def bode(w,H,win=0,frame=0,lcolor='blue',color='black',tcolor='black',freq='rad'): """Plot a bode plot of the transfer function H as a function of w. """ if freq == 'Hz': w = w /2.0 / pi subplot(2,1,win,hsep=120,frame=frame,color=color) gist.plsys(1) gist.plg(20*numpy.log10(abs(H)),w,type='solid',color=lcolor,marks=0) gist.logxy(1,0) gist.gridxy(1,1) if freq == 'Hz': xlabel('Frequency (Hz)',color=tcolor,deltay=-0.005) else: xlabel('Frequency (rad/s)',color=tcolor,deltay=-0.005) ylabel('Magnitude (dB)',color=tcolor,deltax=-0.005) title("Bode Plot",color=tcolor) gist.plsys(2) gist.plg(180/pi*numpy.unwrap(MLab.angle(H)),w,type='solid',color=lcolor,marks=0) gist.logxy(1,0) gist.gridxy(1,1) if freq == 'Hz': xlabel('Frequency (Hz)',color=tcolor,deltay=-0.005) else: xlabel('Frequency (rad/s)',color=tcolor,deltay=-0.005) ylabel('Phase (deg.)',color=tcolor,deltax=-0.005)
def bode(w,H,win=0,frame=0,lcolor='blue',color='black',tcolor='black',freq='rad'): """Plot a bode plot of the transfer function H as a function of w. """ if freq == 'Hz': w = w /2.0 / pi subplot(2,1,win,hsep=120,frame=frame,color=color) gist.plsys(1) gist.plg(20*numpy.log10(abs(H)),w,type='solid',color=lcolor,marks=0) gist.logxy(1,0) gist.gridxy(1,1) if freq == 'Hz': xlabel('Frequency (Hz)',color=tcolor,deltay=-0.005) else: xlabel('Frequency (rad/s)',color=tcolor,deltay=-0.005) ylabel('Magnitude (dB)',color=tcolor,deltax=-0.005) title("Bode Plot",color=tcolor) gist.plsys(2) gist.plg(180/pi*numpy.unwrap(numpy.angle(H)),w,type='solid',color=lcolor,marks=0) gist.logxy(1,0) gist.gridxy(1,1) if freq == 'Hz': xlabel('Frequency (Hz)',color=tcolor,deltay=-0.005) else: xlabel('Frequency (rad/s)',color=tcolor,deltay=-0.005) ylabel('Phase (deg.)',color=tcolor,deltax=-0.005)
def _plot(self): import gist gist.window(self.id, wait=1) gist.animate(1) gist.pltitle(self.title) gist.palette(self.palette) gist.gridxy(self.grid) if self.limits != None: gist.limits(self._getLimit('xmin'), self._getLimit('xmax'), self._getLimit('ymin'), self._getLimit('ymax'))
def _plot(self): import gist gist.window(self.id, wait = 1) gist.animate(1) gist.pltitle(self.title) gist.palette(self.palette) gist.gridxy(self.grid) if self.limits != None: gist.limits(self._getLimit('xmin'), self._getLimit('xmax'), self._getLimit('ymin'), self._getLimit('ymax'))