def problem_1(): f = sy.symbols('f') symbol = wv.battle_lemarie_symbol() # plot symbol symbol_lambda = sy.lambdify(f, symbol, 'numpy') # lambdify for plotting freq = np.linspace(-0.5, 0.5) plt.figure() plt.title('B-L Symbol') plt.xlabel('frequency') plt.plot(freq, [np.abs(symbol_lambda(v)) for v in freq]) plt.show()
def problem_2(): f = sy.symbols('f') symbol = wv.battle_lemarie_symbol() symbol_lambda = sy.lambdify(f, symbol) exp = lambda f: np.sqrt(2)*symbol_lambda(f) n_coef = 23 dc, hp, hn = f_coef(exp=exp, period=1, n=n_coef) print 'dc:' print np.real(dc) print 'hp:' for v in hp: print np.real(v) print 'hn:' for v in hn: print np.real(v)