# Synthesize! H0 = synthesizeNTF(order, OSR, opt=0) H1 = synthesizeNTF(order, OSR, opt=1) # 1. Plot the singularities. subplot(121) # we plot the singularities of the optimized NTF in light # green with slightly bigger markers so that we can better # distinguish the two NTF's when overlayed. plotPZ(H1, markersize=7, color='#90EE90') hold(True) plotPZ(H0, markersize=5) title('NTF Poles and Zeros') f = np.concatenate((np.linspace(0, 0.75/OSR, 100), np.linspace(0.75/OSR, 0.5, 100))) z = np.exp(2j*np.pi*f) magH0 = dbv(evalTF(H0, z)) magH1 = dbv(evalTF(H1, z)) # 2. Plot the magnitude responses. subplot(222) plot(f, magH0, label='All zeros in z=1') hold(True) plot(f, magH1, label='Optimized zeros') figureMagic([0, 0.5], 0.05, None, [-100, 10], 10, None, (16, 8)) xlabel('Normalized frequency ($1\\rightarrow f_s)$') ylabel('dB') legend(loc=4) title('NTF Magnitude Response') # 3. Plot the magnitude responses in the signal band. subplot(224) fstart = 0.01 f = np.linspace(fstart, 1.2, 200)/(2*OSR) z = np.exp(2j*np.pi*f) magH0 = dbv(evalTF(H0, z)) magH1 = dbv(evalTF(H1, z)) semilogx(f*2*OSR, magH0, label='All zeros in z=1') hold(True) semilogx(f*2*OSR, magH1, label='Optimized zeros') axis([fstart, 1.2, -100,- 30]) grid(True) sigma_H0 = dbv(rmsGain(H0, 0, 0.5/OSR)) sigma_H1 = dbv(rmsGain(H1, 0, 0.5/OSR)) #semilogx([fstart, 1], sigma_H0*np.array([1, 1])) plot([fstart, 1], sigma_H0*np.array([1, 1]), 'o-') text(0.15, sigma_H0 + 5, 'RMS gain = %5.0fdB' % sigma_H0) #semilogx([fstart, 1], sigma_H1*np.array([1, 1])) plot([fstart, 1], sigma_H1*np.array([1, 1]), 'o-') text(0.15, sigma_H1 + 5, 'RMS gain = %5.0fdB' % sigma_H1) xlabel('Normalized frequency ($1\\rightarrow f_B$)') ylabel('dB') legend(loc=4) tight_layout()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4