Commit 0971a316 authored by Hafiz Emin Kosar's avatar Hafiz Emin Kosar
Browse files

- added text inducating system's stability to z-Transformation

parent 3f746eb1
......@@ -48,6 +48,7 @@ class zPlot():
#self.filter = 'unit'
self.H0_txt = None
self.systemIsStable = True
self.length = 31
self.n = np.linspace(-15, 15, num=self.length)
......@@ -121,15 +122,15 @@ class zPlot():
self.handles['axh'].set_title('Impulsantwort', fontsize='12')
self.handles['axh'].set_xlabel(r'$\rightarrow n$')
self.handles['axh'].set_ylabel(r'$\uparrow h(n)$')
self.pbzErrortxt = self.handles['axh'].text(-7, 3.25,
'Zählergrad größer als Nennergrad. \nKeine Partialbruchzerlegung möglich!',
fontsize=12, color='rot', visible=False, bbox=ient_wbbox)
self.handles['containerh'] = ient_stem(self.handles['axh'], self.n, self.n)
ient_axis(self.handles['axh'])
self.handles['axH'] = plt.subplot(gs[1, 1])
self.handles['axH'].set_title('Übertragungsfunktion', fontsize='12')
self.handles['axH'].set_xlabel(r'$\rightarrow f$')
self.handles['axH'].set_ylabel(r'$\uparrow |H(f)|$ [dB]')
self.stabilitytxt = self.handles['axH'].text(-6, 0,
'Das System is nicht stabil!',
fontsize=12, color='rot', visible=False, bbox=ient_wbbox)
self.handles['lineH'], = self.handles['axH'].plot(self.f, self.f)
ient_axis(self.handles['axH'])
self.handles['axH'].spines['bottom'].set_position(('outward', 0))
......@@ -421,8 +422,15 @@ class zPlot():
ient_stem_set_ydata(self.handles['containerh'], np.real(h_n))
ient_update_ylim(self.handles['axh'], h_n, 0.19, ymax=1e5)
self.systemIsStable = np.min(roc) < 1 and np.max(roc) > 1
# update f-domain
H_f = ient_iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True)
if self.systemIsStable:
H_f = ient_iz_Hf(self.f, self.H0, poles, zeroes, poles_order, zeroes_order, True)
else:
H_f = np.ones(self.f.shape) * -.5
self.stabilitytxt.set_visible(not self.systemIsStable)
self.handles['lineH'].set_ydata(H_f)
ient_update_ylim(self.handles['axH'], H_f, 1.9, ymax=1e5)
Markdown is supported
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