Commit 60bf784e authored by Hafiz Emin Kosar's avatar Hafiz Emin Kosar
Browse files

- improved demo z transform:

- fixed bug where order of conjugated poles/zeroes would not show up
- adjusted figure margin for better readability
parent 41d8534b
......@@ -87,7 +87,7 @@ class zPlot():
def open_figure(self, fig):
gs = gridspec.GridSpec(2, 2)
gs = gridspec.GridSpec(2, 2, left=0, wspace=0.1)
# First axis for plotting s and h
# axes limits and labels
......@@ -141,7 +141,7 @@ class zPlot():
self.handles['axH'].set_title('Übertragungsfunktion', fontsize='12')
self.handles['axH'].set_xlabel(r'$\rightarrow f$')
self.handles['axH'].set_ylabel(r'$\uparrow |H_\mathrm{a}(f)|$ [dB]')
self.stabilitytxt = self.handles['axH'].text(-10, 0,
self.stabilitytxt = self.handles['axH'].text(-7.5, 0,
'Das System ist nicht stabil!',
fontsize=12, color='rwth:red', visible=False, bbox=rwth_plots.wbbox)
self.handles['lineH'], = self.handles['axH'].plot(self.f, self.f)
......@@ -268,18 +268,23 @@ class zPlot():
# plot / update order if necessary
if self.action == 'add' or self.action == 'del':
if pPoint.order == 1 and pPoint.h_order is not None:
pPoint.h_order.remove()
pPoint.h_order[0].remove()
pPoint.h_order[1].remove()
pPoint.h_order = None
elif pPoint.order == 2:
if pPoint.h_order is None:
align = 'left' if self.mode == 'p' else 'right'
pPoint.h_order = self.ax.text(pPoint.p.real, abs(pPoint.p.imag), '({:1.0f})'.format(pPoint.order),
fontsize=12, horizontalalignment=align, verticalalignment='bottom')
pPoint.h_order = (self.ax.text(pPoint.p.real, abs(pPoint.p.imag), '({:1.0f})'.format(pPoint.order),
fontsize=12, horizontalalignment=align, verticalalignment='bottom'),
self.ax.text(pPoint.p.real, -abs(pPoint.p.imag), '({:1.0f})'.format(pPoint.order),
fontsize=12, horizontalalignment=align, verticalalignment='bottom'))
else:
pPoint.h_order.set_text('({:1.0f})'.format(pPoint.order))
pPoint.h_order[0].set_text('({:1.0f})'.format(pPoint.order))
pPoint.h_order[1].set_text('({:1.0f})'.format(pPoint.order))
elif pPoint.order > 2:
pPoint.h_order.set_text('({:1.0f})'.format(pPoint.order))
pPoint.h_order[0].set_text('({:1.0f})'.format(pPoint.order))
pPoint.h_order[1].set_text('({:1.0f})'.format(pPoint.order))
# elif self.action == 'roc':
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment