📄 cat
字号:
PKMC_FILT(1-ESPS) ENTROPIC RESEARCH LABNNNNAAAAMMMMEEEE pkmc_filt - design an equiripple FIR filter using the Parks-McClellan algorithmSSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ppppkkkkmmmmcccc____ffffiiiilllltttt ----PPPP _p_a_r_a_m__f_i_l_e [ ----xxxx _d_e_b_u_g__l_e_v_e_l ] _f_i_l_e._f_i_l_t_e_rDDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN The program _p_k_m_c__f_i_l_t designs a linear-phase finite-impulse response (FIR) filter that meets the specification defined in the parameter file _p_a_r_a_m__f_i_l_e. The filter coefficients are saved in the output file _f_i_l_e._f_i_l_t_e_r. If _f_i_l_e._f_i_l_t_e_r is replaced by "-", the standard output is written. The design method is based on the Parks-McClellan algorithm. The resulting filter minimizes the maximum-weighted approximation-error. One of the four standard FIR types is produced. For a filter with multiple stopbands and passbands, the Type 1 (symmetric and odd length) or Type 2 (symmetric and even length) filter is designed. For a dif- ferentiator or a Hilbert Transformer, either the Type 3 (anti-symmetric and odd length) or the Type 4 (anti- symmmetric and even length) is designed. Frequency responses of Types 2 and 3 filters are equal to 0 at PI, which is undesirable for a highpass filter. For mul- tiple stopbands/passbands filters, type 1 and 2 are used. For differentiator and Hilbert transformer, type 3 and 4 are used. A generic Parks-McClellan algorithm is implemented here, without numerical optimization. Numerical problem occurs for filter with more than 100 taps, narrow passbands/stopbands, large transition bands, and non- symmetrical transition bands. In some cases, the algorithm does not detect the problem. Typically the filter gain for such cases are large, exceeding 1.0. Always check the result by _f_i_l_t_s_p_e_c (_1-_E_S_P_S) and _p_l_o_t_s_p_e_c (_1-_E_S_P_S). Also see the shell script _x_f_i_r__f_i_l_t(_1-_E_S_P_S) that is a cover script for this and other FIR filter design programs.OOOOPPPPTTTTIIIIOOOONNNNSSSS The following option is supported: ----xxxx _d_e_b_u_g__l_e_v_e_l [0] If _d_e_b_u_g__l_e_v_e_l is positive, _p_k_m_c__f_i_l_t prints debugging messages and other information on the standard error output. The messages proliferate as the _d_e_b_u_g__l_e_v_e_l increases. If _d_e_b_u_g__l_e_v_e_l is 0 (the default), no mes- sages are printed. Copyright Entropic Research Laboratory, Inc. 1G1 1PKMC_FILT(1-ESPS) ENTROPIC RESEARCH LABEEEESSSSPPPPSSSS PPPPAAAARRRRAAAAMMMMEEEETTTTEEEERRRRSSSS The following parameters are read from the _p_a_r_a_m__f_i_l_e: _f_i_l_t__t_y_p_e - _s_t_r_i_n_g The type of filter desired. Use _M_U_L_T_I_B_A_N_D for lowpass, highpass, bandpass, bandstop, and arbitrary multiple stop/passbands FIRs. Use _D_I_F_F_E_R_E_N_T_I_A_T_O_R for a dif- ferentiator and _H_I_L_B_E_R_T for Hilbert transform filter. _f_i_l_t__l_e_n_g_t_h - _i_n_t Number of taps for the filter. _n_g_r_i_d - _i_n_t This is an optional parameter. It specifies the number of grid points used for interpolation from 0 to PI/2. The default value is 2 * _f_i_l_t__l_e_n_g_t_h. _s_a_m_p__f_r_e_q - _f_l_o_a_t The sampling frequency. This number is used for res- caling the values of bandedge parameters. _n_b_a_n_d_s - _i_n_t Number of bands from 0 to _s_a_m_p__f_r_e_q/_2. For example, for a _M_U_L_T_I_B_A_N_D filter type, a lowpass filter has 2 bands -- a passband from 0 to some frequency _f_1 and a stopband from some frequency _f_2 to _s_a_m_p__f_r_e_q/_2, where _f_1<_f_2. For a differentiator, _n_b_a_n_d_s is 1 if a full band differentiator is desired, 2 otherwise. For a Hil- bert transform filter, _n_b_a_n_d_s is always 1, and its band extend from 0 to _s_a_m_p__f_r_e_q/_2. The following set of the parameters have the forms of _b_a_n_d[_i]__e_d_g_e_1, _b_a_n_d[_i]__e_d_g_e_2, _b_a_n_d[_i]__d_e_s, and _b_a_n_d[_i]__w_t, where _i denotes the band number. For example, _b_a_n_d_2__e_d_g_e_1 is a parameter for the left edge of the second band. The number of sets of these parameters must be equal to _n_b_a_n_d_s. Band 1 is the left-most band, band _n_b_a_n_d is the right-most band. The response at the band edges is automatically determined by the algorithm, the error on the band edge is the same equi-ripple error of the band. The generic header item _r_i_p_p_l_e__d_b in the output file contains the equi-ripple error in dB that represents the smallest approximation error that meets the specification. _b_a_n_d[_i]__e_d_g_e_1 - _f_l_o_a_t The left edge of _ith band. It must be 0 for _b_a_n_d_1__e_d_g_e_1. _b_a_n_d[_i]__e_d_g_e_2 - _f_l_o_a_t The right edge of _ith band. It must be _s_a_m_p__f_r_e_q/_2 for Copyright Entropic Research Laboratory, Inc. 2G2 2PKMC_FILT(1-ESPS) ENTROPIC RESEARCH LAB the last band. _b_a_n_d[_i]__e_d_g_e_2 and _b_a_n_d[_i+_1]__e_d_g_e_1 can not be the same number. In fact _b_a_n_d[_i]__e_d_g_e_2 > _b_a_n_d[_i+_1]__e_d_g_e_1. _b_a_n_d[_i]__d_e_s - _f_l_o_a_t For _M_U_L_T_I_B_A_N_D filter type, it is the desired constant value for the _ith band. For _D_I_F_F_E_R_E_N_T_I_A_T_O_R filter type, it is the slope of the frequency response on the passband. The slope is measured by the amplitude response over normalized frequency axis. For _H_I_L_B_E_R_T, it should be set to 1. _b_a_n_d[_i]__w_t - _f_l_o_a_t For _M_U_L_T_I_B_A_N_D filter type, it is the constant weighting factor for the approximation error in _ith band. The weights in bands are relative to one another. For example, in a two band filter, _b_a_n_d_1__w_t of 10 and _b_a_n_d_2__w_t of 20 are the same as _b_a_n_d_1__w_t of 1 and 2 for the other band. For _D_I_F_F_E_R_E_N_T_I_A_T_O_R filter type, the weighting function _1/_f is appplied to the the passband region of the differentiator. For _H_I_L_B_E_R_T, it should always be set to 1.EEEESSSSPPPPSSSS CCCCOOOOMMMMMMMMOOOONNNN No ESPS common parameter processing is used.EEEESSSSPPPPSSSS HHHHEEEEAAAADDDDEEEERRRRSSSS A new FEAFILT header is created for the output file. The program fills in appropriate values in the common part of the header as well as the following generic header items associated with the FEAFILT type. The _s_a_m_p__f_r_e_q generic header item contains value of the _s_a_m_p__r_e_q parameter. The _b_a_n_d__e_d_g_e_s generic header item of size _2*_n_b_a_n_d_s is an array containing the left and rights band edges of bands. The _d_e_s_i_r_e_d__v_a_l_u_e generic header item of size _n_b_a_n_d_s is an array containing the _b_a_n_d[_i]__d_e_s parameters The _d_e_s_i_r_e_d__w_e_i_g_h_t generic header item of size _n_b_a_n_d_s is an array containing the _b_a_n_d[_i]__w_t parameters The _r_i_p_p_l_e__d_b generic header item of size _n_b_a_n_d_s is an array containing the error in dB for each band. In addition, the generic header item _d_e_l_a_y__s_a_m_p_l_e_s (type DOUBLE) is added to the header. _D_e_l_a_y__s_a_m_p_l_e_s is equal to (filter length - 1)/2. This represents the delay to the center of the peak of the impulse response. Copyright Entropic Research Laboratory, Inc. 3G3 3PKMC_FILT(1-ESPS) ENTROPIC RESEARCH LABFFFFUUUUTTTTUUUURRRREEEE CCCCHHHHAAAANNNNGGGGEEEESSSSEEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS The following parameter file designs a bandpass filter with stop band from 0 to 500 Hz, passband from 1000 to 2000 Hz, and stopband from 2500 to 4000 Hz. int filt_length = 32; float band1_edge1 = 0.000000; float band1_edge2 = 500.000000; float band1_des = 0.000000; float band1_wt = 1.000000; float band2_edge1 = 1000.000000; float band2_edge2 = 2000.000000; float band2_des = 1.000000; float band2_wt = 1.000000; float band3_edge1 = 2500.000000; float band3_edge2 = 4000.000000; float band3_des = 0.000000; float band3_wt = 1.000000; string filt_type = "MULTIBAND"; float samp_freq = 8000.000000; int nbands = 3; The unspecified regions from 500 to 1000 Hz and 2000 to 2500 Hz are unspecified and are taken as transition bands which will have arbitray repsonse.EEEERRRRRRRROOOORRRRSSSS AAAANNNNDDDD DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSSBBBBUUUUGGGGSSSS None known.RRRREEEEFFFFEEEERRRREEEENNNNCCCCEEEESSSS Oppenheim & Schafer, _D_i_s_c_r_e_t_e-_T_i_m_e _S_i_g_n_a_l _P_r_o_c_e_s_s_i_n_g, Pren- tice Hall, 1989SSSSEEEEEEEE AAAALLLLSSSSOOOO xfir_filt(1- ESPS), cb_filt(1 - ESPS), win_filt(1 - ESPS), notch_filt(1 - ESPS), FEA_FILT(5 - ESPS), atofilt(1-ESPS), wmse_filt(1-ESPS), iir_filt(1-ESPS), sfconvert(1-ESPS)AAAAUUUUTTTTHHHHOOOORRRR Derek Lin Copyright Entropic Research Laboratory, Inc. 4G4 4
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -