CN103888104B - Method and system for designing FIR digital filter - Google Patents
Method and system for designing FIR digital filter Download PDFInfo
- Publication number
- CN103888104B CN103888104B CN201410065055.0A CN201410065055A CN103888104B CN 103888104 B CN103888104 B CN 103888104B CN 201410065055 A CN201410065055 A CN 201410065055A CN 103888104 B CN103888104 B CN 103888104B
- Authority
- CN
- China
- Prior art keywords
- filter
- model
- population
- fir digital
- filter design
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000013461 design Methods 0.000 claims abstract description 87
- 230000002068 genetic effect Effects 0.000 claims abstract description 46
- 238000013178 mathematical model Methods 0.000 claims abstract description 22
- 238000001914 filtration Methods 0.000 claims abstract description 7
- 230000004044 response Effects 0.000 claims description 27
- 238000012545 processing Methods 0.000 claims description 22
- 239000011159 matrix material Substances 0.000 claims description 9
- 238000005070 sampling Methods 0.000 claims description 9
- 230000035772 mutation Effects 0.000 claims description 8
- FGUUSXIOTUKUDN-IBGZPJMESA-N C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 Chemical compound C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 FGUUSXIOTUKUDN-IBGZPJMESA-N 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 5
- 238000005457 optimization Methods 0.000 claims description 3
- 238000007670 refining Methods 0.000 abstract 1
- 238000002939 conjugate gradient method Methods 0.000 description 12
- 238000005516 engineering process Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000013459 approach Methods 0.000 description 3
- 230000007704 transition Effects 0.000 description 3
- 230000003044 adaptive effect Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000012887 quadratic function Methods 0.000 description 2
- 238000001228 spectrum Methods 0.000 description 2
- GNFTZDOKVXKIBK-UHFFFAOYSA-N 3-(2-methoxyethoxy)benzohydrazide Chemical compound COCCOC1=CC=CC(C(=O)NN)=C1 GNFTZDOKVXKIBK-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000001364 causal effect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
Landscapes
- Complex Calculations (AREA)
Abstract
一种FIR数字滤波器设计方法和系统,其中方法包括步骤:根据滤波器设计需求对FIR数字滤波器进行建模获得滤波器的数学模型;根据所述数学模型对滤波器的参数限制条件进行细化获得条件加权模型;利用遗传算法与最小二乘法求解所述条件加权模型获得最优的滤波器系数;根据所述滤波器系数获取满足所述实际滤波需求的FIR数字滤波器。本发明的技术方案,可得到不同的性能的滤波器设计,得到最优滤波器设计系数,设计出最优的FIR数字滤波器。
A method and system for designing an FIR digital filter, wherein the method includes the steps of: modeling the FIR digital filter according to filter design requirements to obtain a mathematical model of the filter; refining the parameter constraints of the filter according to the mathematical model obtain the conditional weighting model; use the genetic algorithm and the least squares method to solve the conditional weighting model to obtain the optimal filter coefficient; obtain the FIR digital filter that meets the actual filtering requirements according to the filter coefficient. The technical scheme of the invention can obtain filter designs with different performances, obtain optimal filter design coefficients, and design optimal FIR digital filters.
Description
技术领域technical field
本发明涉及数字滤波器设计领域,特别是涉及一种FIR数字滤波器设计方法和系统。The invention relates to the field of digital filter design, in particular to a FIR digital filter design method and system.
背景技术Background technique
在无线通信系统中,终端的接收信号一般夹杂噪声和一些无用的信号成分,需要通过滤波器将其进行滤除。为此,滤波器在现代信号处理以及电子应用技术领域有着非常重要的应用价值。传统的模拟滤波器存在设计复杂、结构庞大、原件数量多等缺点。随着计算机技术大规模集成电路技术在滤波器设计领域中的广泛应用,数字滤波器的研发与应用成为主流。与模拟滤波器相比,数字滤波器具有精度高,灵活性好,便于大规模集成等优点,目前的研究热点主要集中于数字滤波器的优化设计。In a wireless communication system, the received signal of a terminal is generally mixed with noise and some useless signal components, which need to be filtered out by a filter. For this reason, filters have very important application value in the field of modern signal processing and electronic application technology. Traditional analog filters have disadvantages such as complex design, large structure, and large number of original components. With the wide application of computer technology large-scale integrated circuit technology in the field of filter design, the research and development and application of digital filters have become the mainstream. Compared with analog filters, digital filters have the advantages of high precision, good flexibility, and easy large-scale integration. The current research hotspots mainly focus on the optimal design of digital filters.
基于数字滤波器的实际性能,数字滤波器在信号处理、地质勘查、数字通信、图像传输、自适应控制等领域有非常重要的作用,数字滤波器的优化设计有很大的实际意义。由于理想滤波器具有非因果性,对实时信号处理应用来说,理想滤波器在物理上是不可实现的,在实际的设计中,设计者一般会设计具有因果性的滤波器来逼近理想频率响应特征。Based on the actual performance of digital filters, digital filters play a very important role in signal processing, geological exploration, digital communication, image transmission, adaptive control and other fields, and the optimal design of digital filters has great practical significance. Due to the non-causality of ideal filters, ideal filters are physically unrealizable for real-time signal processing applications. In actual design, designers generally design causal filters to approximate the ideal frequency response. feature.
目前,设计线性相位有限脉冲响应(Finite Impulse Response,FIR)滤波器主要有窗函数法、频率采样法、切比雪夫(Chebyshev)逼近法等。其中窗函数法是利用窗函数将在时间上无限的理想滤波器单位冲击响应进行截断,使得设计出的滤波器逼近理想滤波器的性能要求。但是窗函数法设计滤波器对于窗函数的类型要求很高,并且效率较低。使用频率采样方法设计FIR滤波器时,一般将期望频率响应等间距的分成频率段。同时为了消弱旁瓣,需要对滤波器过渡带的频率段进行优化。频率采样法是通过在频率上采样,并在采样点上用插值的方法逼近理想滤波器频率响应。切比雪夫逼近法的设计原则是将理想频率响应和实际频率响应之间的加权逼近误差均匀地分散到滤波器的这个通带和阻带,并且最小化滤波器的最大误差。At present, the design of linear phase finite impulse response (Finite Impulse Response, FIR) filter mainly includes window function method, frequency sampling method, Chebyshev (Chebyshev) approximation method and so on. Among them, the window function method is to use the window function to truncate the unit impulse response of the ideal filter which is infinite in time, so that the designed filter can approach the performance requirements of the ideal filter. However, the filter design by the window function method has high requirements on the type of window function, and the efficiency is low. When using the frequency sampling method to design an FIR filter, the desired frequency response is generally divided into frequency segments at equal intervals. At the same time, in order to weaken the side lobe, it is necessary to optimize the frequency segment of the transition band of the filter. The frequency sampling method is to approach the ideal filter frequency response by sampling on the frequency and interpolating at the sampling point. The design principle of the Chebyshev approximation method is to evenly disperse the weighted approximation error between the ideal frequency response and the actual frequency response to the passband and stopband of the filter, and minimize the maximum error of the filter.
无论哪种FIR滤波器设计方法都是对理想滤波器的逼近。为了更方便的刻画设计得到的滤波器同理想滤波器的逼近程度,一些学者提出了均方误差最小准则,该准则的本质是使得实际得到的滤波器频率响应与理想滤波器频率响应的误差能量最小。No matter which FIR filter design method is an approximation to the ideal filter. In order to more conveniently describe the degree of approximation between the designed filter and the ideal filter, some scholars have proposed the minimum mean square error criterion. The essence of this criterion is to make the error energy of the actual filter frequency response and the ideal filter frequency response minimum.
关于基于均方误差最小化准则的FIR数字滤波器优化设计现有的技术方案有如下:The existing technical solutions for the optimal design of FIR digital filters based on the mean square error minimization criterion are as follows:
第一、通过遗传算法来确定过渡带样本值,代替传统的查表法,以更快的速度获得优化解。第二、根据预期的频率特性的设计要求,建立窗函数权值的优化模型,并通过快速自适应遗传算法来求解优化值。First, the transition zone sample value is determined by genetic algorithm, instead of the traditional look-up table method, and the optimal solution is obtained at a faster speed. Second, according to the design requirements of the expected frequency characteristics, the optimization model of the window function weight is established, and the optimal value is solved by a fast adaptive genetic algorithm.
针对于上述第一种方案,其主要特点在于以遗传算法来代替原有的查表法,期望以较快的速度获得优化解。然而,利用遗传算法无法保证求得解是最优解,并且算法实施具有一定的复杂性,求解时间也较长,使得其并不能直接指导工程设计工作,最终获得的解不一定就是最优解,精度低。而对于第二种方案,其主要特点在于利用遗传算法去求解窗函数的参数,其本质上基于窗函数的滤波器设计方法中存在的问题研究存在,包括窗函数的选取、参数的优化设定时间长等。For the above-mentioned first scheme, its main feature is to replace the original look-up table method with a genetic algorithm, and it is expected to obtain an optimal solution at a faster speed. However, the genetic algorithm cannot guarantee that the solution obtained is the optimal solution, and the implementation of the algorithm has a certain complexity, and the solution time is also long, so that it cannot directly guide the engineering design work, and the final solution may not be the optimal solution , low precision. For the second scheme, its main feature is to use the genetic algorithm to solve the parameters of the window function. In essence, there are problems in the filter design method based on the window function, including the selection of the window function and the optimal setting of the parameters. Wait for a long time.
综上所述,现有的FIR滤波器设计技术,无法根据实际滤波器的设计需求对主瓣和旁瓣的性能需求进行自动调节,难以得到符合实际的滤波器,面对极小化问题,难以获得最优解,从而不能给出相应最优的滤波器设计系数。In summary, the existing FIR filter design technology cannot automatically adjust the performance requirements of the main lobe and side lobes according to the design requirements of the actual filter, and it is difficult to obtain a filter that meets the reality. Facing the minimization problem, It is difficult to obtain the optimal solution, so that the corresponding optimal filter design coefficients cannot be given.
发明内容Contents of the invention
基于此,有必要针对上述问题,提供一种FIR数字滤波器设计方法和系统,可根据实际的滤波器设计需求对主瓣和旁瓣的性能需求进行自动调节,以得到符合实际的滤波器,并且可快速获得最优解,从而给出相应最优的滤波器设计系数。Based on this, it is necessary to provide a FIR digital filter design method and system for the above problems, which can automatically adjust the performance requirements of the main lobe and side lobes according to the actual filter design requirements, so as to obtain a practical filter. And the optimal solution can be obtained quickly, so as to give the corresponding optimal filter design coefficients.
一种FIR数字滤波器设计方法,包括如下步骤:A kind of FIR digital filter design method, comprises the steps:
根据滤波器设计需求对FIR数字滤波器进行建模获得滤波器的数学模型;Model the FIR digital filter according to the filter design requirements to obtain the mathematical model of the filter;
根据所述数学模型对滤波器的参数限制条件进行细化获得条件加权模型;refine parameter constraints of the filter according to the mathematical model to obtain a conditional weighted model;
利用遗传算法与最小二乘法求解所述条件加权模型获得最优的滤波器系数;Solving the conditional weighting model by genetic algorithm and least square method to obtain optimal filter coefficients;
根据所述滤波器系数获取满足所述实际滤波需求的FIR数字滤波器。An FIR digital filter meeting the actual filtering requirement is obtained according to the filter coefficients.
一种FIR数字滤波器设计系统,包括:A FIR digital filter design system, comprising:
数学建模模块,用于根据滤波器设计需求对FIR数字滤波器进行建模获得滤波器的数学模型;The mathematical modeling module is used to model the FIR digital filter according to the filter design requirements to obtain the mathematical model of the filter;
条件细化模块,用于根据所述数学模型对滤波器的参数限制条件进行细化获得条件加权模型;A condition refinement module, configured to refine parameter constraints of the filter according to the mathematical model to obtain a condition weighted model;
模型求解模块,用于利用遗传算法与最小二乘法求解所述条件加权模型获得最优的滤波器系数;A model solution module, used to solve the conditional weighted model using genetic algorithm and least square method to obtain optimal filter coefficients;
滤波器设计模块,用于根据所述滤波器系数获取满足所述实际滤波需求的FIR数字滤波器。A filter design module, configured to obtain an FIR digital filter that meets the actual filtering requirements according to the filter coefficients.
上述FIR数字滤波器设计方法和系统,可以根据实际的不同需求,对旁瓣和主瓣进行加权求和,从而可得到不同性能的滤波器设计,算法求解过程将遗传算法与最小二乘法相结合,可全局快速搜索最优的滤波系数,获取满足实际需求的最优的滤波器,加快了算法的收敛速度,提升了算法的搜索精度,从而可以得到最优滤波器设计系数,设计出最优的FIR数字滤波器。The above-mentioned FIR digital filter design method and system can carry out weighted summation of the side lobe and main lobe according to different actual needs, so as to obtain filter designs with different performances. The algorithm solution process combines the genetic algorithm with the least squares method , can quickly search the optimal filter coefficient globally, obtain the optimal filter that meets the actual needs, speed up the convergence speed of the algorithm, and improve the search accuracy of the algorithm, so that the optimal filter design coefficient can be obtained, and the optimal filter can be designed. The FIR digital filter.
附图说明Description of drawings
图1为本发明FIR数字滤波器设计方法流程图;Fig. 1 is the flow chart of FIR digital filter design method of the present invention;
图2为混合遗传算法流程图;Fig. 2 is a hybrid genetic algorithm flow chart;
图3为本发明FIR数字滤波器设计系统结构示意图。FIG. 3 is a schematic structural diagram of the FIR digital filter design system of the present invention.
具体实施方式detailed description
下面结合附图对本发明的FIR数字滤波器设计方法和系统的具体实施方式作详细描述。The specific implementation of the FIR digital filter design method and system of the present invention will be described in detail below in conjunction with the accompanying drawings.
参考图1所示,图1为本发明FIR数字滤波器设计方法流程图;主要包括如下步骤:With reference to shown in Fig. 1, Fig. 1 is the flow chart of FIR digital filter design method of the present invention; Mainly comprise the following steps:
步骤S10,根据滤波器设计需求对FIR数字滤波器进行建模获得滤波器的数学模型。Step S10, modeling the FIR digital filter according to filter design requirements to obtain a mathematical model of the filter.
在本步骤中,主要是根据实际的不同需求,对旁瓣和主瓣进行加权求和,从而可得到不同的性能的滤波器设计,由于在滤波器的设计中,需要尽可能保证频谱通过主瓣,旁瓣要尽量小以阻止该频段的频谱衰减,采用最小均方差,不能根据实际需求进行调节。In this step, the sidelobe and mainlobe are weighted and summed mainly according to different actual requirements, so that filter designs with different performances can be obtained. Because in the design of the filter, it is necessary to ensure that the spectrum passes through the main lobe as much as possible. The lobes and side lobes should be as small as possible to prevent the spectrum attenuation of this frequency band, and the minimum mean square error should be adopted, which cannot be adjusted according to actual needs.
因此,在本发明设计中,采用加权的方式进行滤波器的设计,从而可以根据实际的设计需求对主瓣和旁瓣的性能需求进行自动调节,以得到符合实际的滤波器。Therefore, in the design of the present invention, the filter is designed in a weighted manner, so that the performance requirements of the main lobe and side lobes can be automatically adjusted according to actual design requirements, so as to obtain an actual filter.
在一个实施例中,对于步骤S10的建模方法,具体可以如下:In one embodiment, for the modeling method of step S10, it may be specifically as follows:
首先,建立加权的滤波设计模型;其中,用Hd(ejw)表示理想滤波器频率响应,H(ejw)表示实际得到的滤波器频率响应,用E(ejw)表示频率响应误差,滤波设计模型具体形式如下:First, a weighted filter design model is established; where H d (e jw ) represents the ideal filter frequency response, H(e jw ) represents the actual filter frequency response, and E(e jw ) represents the frequency response error, The specific form of the filter design model is as follows:
E(ejw)=Hd(ejw)-H(ejw). (1)E(e jw )=H d (e jw )-H(e jw ). (1)
计算均方误差e2,e2表达式为Calculate the mean square error e 2 , the expression of e 2 is
利用快速傅里叶变换(FFT)对上述两式进行处理,可以得到Using the fast Fourier transform (FFT) to process the above two equations, we can get
将上式(3)代入均方误差公式(2)中,表达式如下:Substituting the above formula (3) into the mean square error formula (2), the expression is as follows:
根据帕塞瓦公式,可以得到According to Parseval's formula, we can get
在上式中,等式左边第二个和式为常数,与设计值h(n),n=0,1,…,N-1无关;要使得e2最小,只需第一个和式最小,在此只需要关注等式右端第一部分。In the above formula, the second sum on the left side of the equation is a constant, which has nothing to do with the design value h(n), n=0,1,...,N-1; to make e 2 the smallest, only the first sum is needed Minimal, only the first part of the right-hand side of the equation needs to be concerned here.
为了获取滤波系数,只需要在[-π,π]上取M个频率采样点wk(k=0,1,…,M-1),得到一组h(n),n=0,1,…,N-1,使得In order to obtain the filter coefficient, it is only necessary to take M frequency sampling points w k (k=0,1,...,M-1) on [-π,π] to obtain a set of h(n), n=0,1 ,…,N-1, such that
最小,获得的取值为最小的滤波器设计参数值。Minimum, the obtained value is the minimum filter design parameter value.
进一步地,为了计算简单且易于操作,将求解过程可以转化为矩阵及向量的操作,具体如下:Furthermore, for the sake of simple calculation and easy operation, the solution process can be transformed into matrix and vector operations, as follows:
令make
其中,ξ=[h(0),h(1),…h(N-1)]T,H=[Hd(w1),Hd(w2),…,Hd(wM)],则上述加权滤波设计模型简化为Among them, ξ=[h(0),h(1),…h(N-1)] T , H=[H d (w 1 ),H d (w 2 ),…,H d (w M ) ], then the above weighted filter design model is simplified as
式中,表示二范数,对于所述二范数,即x=(x1,x2,…,xN),则
需要声明的是,上述建模方法及其数学模型,是基于优选的建立加权的滤波设计模型方法及其模型表示形式,实际运用中并不限定于上述优选实施例中阐述的技术方案。It should be declared that the above modeling method and its mathematical model are based on the preferred method of establishing a weighted filter design model and its model representation, and the actual application is not limited to the technical solutions described in the above preferred embodiments.
步骤S20,根据所述数学模型对滤波器的参数限制条件进行细化获得条件加权模型。Step S20, refine the parameter limit conditions of the filter according to the mathematical model to obtain a condition weighted model.
在本步骤中,针对于滤波器设计的实际需求主要表现形式是主瓣和旁瓣关注度,根据实际需求对滤波器的参数限制条件进行细化,从而得到在该限制条件下的加权模型。In this step, the main form of the actual demand for filter design is the main lobe and side lobe attention. According to the actual demand, the parameter limit conditions of the filter are refined, so as to obtain the weighted model under the limit conditions.
在一个实施例中,为了改善FIR滤波器性能,要求窗函数的主瓣宽度尽可能窄,以获得较窄的过渡带;旁瓣高度的相对值尽可能小,数量尽可能少,以获得通带波纹小,阻带衰减大,在通带和阻带内均平稳的特点,这样可使滤波器实际频率响应更好地逼近理想频率响应。In one embodiment, in order to improve the performance of the FIR filter, the main lobe width of the window function is required to be as narrow as possible to obtain a narrower transition zone; the relative value of the side lobe height is as small as possible, and the number is as small as possible to obtain a pass The band ripple is small, the stop band attenuation is large, and it is stable in the pass band and stop band, so that the actual frequency response of the filter can better approach the ideal frequency response.
具体处理方法是,首先设立相关的权函数矩阵,具体格式如下The specific processing method is to first set up the relevant weight function matrix, and the specific format is as follows
其中,此时,公式(8)的加权模型改写成in, At this point, the weighted model of formula (8) is rewritten as
式中,表示二范数,F为目标函数。In the formula, Indicates the two-norm, and F is the objective function.
同样需要声明的是,上述对滤波器的参数限制条件进行细化,是基于优选的实施例,实际运用中并不限定于上述优选实施例中阐述的技术方案。It should also be stated that the above refinement of the parameter restriction conditions of the filter is based on the preferred embodiment, and the actual application is not limited to the technical solution described in the above preferred embodiment.
步骤S30,利用遗传算法与最小二乘法求解所述条件加权模型获得最优的滤波器系数。Step S30, using the genetic algorithm and the least squares method to solve the conditional weighting model to obtain optimal filter coefficients.
在本步骤中,即将进化算法中的遗传算法与共轭梯度算法相结合,从而可全局快速搜索最优的滤波系数。该算法充分利用遗传算法的全局搜索能力和共轭梯度法的快速局部搜索能力,加快了遗传算法的收敛速度,提升了遗传算法的搜索精度。因此,可得出最优滤波器设计系数。In this step, the genetic algorithm in the evolutionary algorithm is combined with the conjugate gradient algorithm, so that the optimal filter coefficient can be quickly searched globally. This algorithm makes full use of the global search ability of genetic algorithm and the fast local search ability of conjugate gradient method, which accelerates the convergence speed of genetic algorithm and improves the search accuracy of genetic algorithm. Therefore, the optimal filter design coefficients can be derived.
具体的,为快速求解模型的最优解,本发明将进化算法中的遗传算法与传统经典共轭梯度算法分别进行改进并结合应用,本文简称混合遗传算法。通过相应技术手段各取算法的优势,利用遗传算法的全局搜索能力和共轭梯度法的快速收敛特性进行求解。通过共轭梯度算法提高遗传算法的收敛速度,从而能更快收敛到精确解,通过遗传算法帮助共轭梯度法跳出局部最优解,共轭梯度法嵌入到遗传算法,无需将遗传算法种群中所有的个体均执行共轭梯度法,只需考虑对遗传算法种群中心个体执行共轭梯度法即可。Specifically, in order to quickly solve the optimal solution of the model, the present invention respectively improves the genetic algorithm in the evolutionary algorithm and the traditional classic conjugate gradient algorithm and applies them in combination, which is referred to as the hybrid genetic algorithm herein. The advantages of each algorithm are taken by corresponding technical means, and the global search ability of the genetic algorithm and the fast convergence characteristic of the conjugate gradient method are used to solve the problem. Improve the convergence speed of the genetic algorithm through the conjugate gradient algorithm, so that it can converge to an accurate solution faster. The genetic algorithm helps the conjugate gradient method jump out of the local optimal solution. The conjugate gradient method is embedded in the genetic algorithm without the need to integrate the genetic algorithm population. All individuals perform the conjugate gradient method, and only the center individual of the genetic algorithm population needs to be considered to perform the conjugate gradient method.
在一个实施例中,具体求解模型获取滤波器系数的方法包括如下步骤:In one embodiment, the method for obtaining filter coefficients by specifically solving the model includes the following steps:
根据所述加权模型建立遗传算法的模型;具体的,种群个数为m,个体分别为ai∈Rn,i=1,2,…,m。A genetic algorithm model is established according to the weighted model; specifically, the number of populations is m, and the individuals are respectively a i ∈ R n , i=1, 2,...,m.
将所述模型的种群中心设为共轭梯度算法处理的初始搜索点;其中,所述中心为种群个体的平均值,表达式为:m为种群个数,个体分别为ai∈Rn,i=1,2,…,m;由于共轭梯度法具有二次终止性,即对于二次函数,算法可在n步迭代后终止。Set the population center of the model as the initial search point processed by the conjugate gradient algorithm; wherein, the center is the average value of population individuals, and the expression is: m is the number of populations, and the individuals are a i ∈ R n , i=1,2,...,m; due to the quadratic termination of the conjugate gradient method, that is, for quadratic functions, the algorithm can be terminated after n iterations .
执行n步共轭梯度算法处理获得结果a(n),计算a(n)的适应度函数,并据a(n)生成一个个体,将该个体加入到种群中替换适应度值最小的个体;具体的,对于非二次函数,执行n步也可得到较好的效果,因此,将a0作为共轭梯度法的初始搜索点并执行n步共轭梯度法,所得到的结果即为a(n)。计算a(n)的适应度函数,并根据a(n)生成一个个体然后再加入到种群中,以替换适应度值最小的个体,从而使种群规模保持为m。Execute n-step conjugate gradient algorithm processing to obtain the result a (n) , calculate the fitness function of a ( n), and generate an individual according to a (n) , add the individual to the population to replace the individual with the smallest fitness value; Specifically, for non-quadratic functions, better results can be obtained by executing n steps. Therefore, if a 0 is used as the initial search point of the conjugate gradient method and the n-step conjugate gradient method is executed, the result obtained is a (n) . Calculate the fitness function of a ( n ), and generate an individual based on a (n) and then join the population to replace the individual with the smallest fitness value, so that the population size remains m.
循环执行下一次遗传算法迭代处理和共轭梯度算法和处理步骤,即循环执行混合遗传算法,直至求解出加权模型的最优解,将该最优解设为滤波器系数。The next genetic algorithm iterative processing and the conjugate gradient algorithm and processing steps are cyclically executed, that is, the hybrid genetic algorithm is cyclically executed until the optimal solution of the weighted model is obtained, and the optimal solution is set as the filter coefficient.
为了更加清晰步骤S30的算法过程,下面结合附图阐述一个算法实例。In order to make the algorithm process of step S30 clearer, an algorithm example will be described below in conjunction with the accompanying drawings.
参考图2所示,图2为混合遗传算法流程图,主要包括如下步骤:Referring to Figure 2, Figure 2 is a flow chart of the hybrid genetic algorithm, which mainly includes the following steps:
步骤a、初始化产生初始种群;其中,设置种群规模为m,交叉概率为pc,变异概率为pm,设置迭代次数为n;Step a, initialize and generate an initial population; among them, set the population size as m, the crossover probability as p c , the mutation probability as p m , and the number of iterations as n;
步骤b、计算个体适应度函数F,即目标函数;Step b. Calculating the individual fitness function F, which is the objective function;
步骤c、执行交叉算子和变异算子;Step c, execute crossover operator and mutation operator;
步骤d、计算种群的中心a0;Step d, calculate the center a 0 of the population;
步骤e、初始化共轭梯度算法的搜索点,即将a0设为共轭梯度算法处理的初始搜索点;其中,设置k=1,设置迭代次数n0,设置精度要求ε,并执行如下算法处理:Step e. Initialize the search point of the conjugate gradient algorithm, that is, set a 0 as the initial search point for the conjugate gradient algorithm; among them, set k=1, set the number of iterations n 0 , set the accuracy requirement ε, and perform the following algorithm processing :
步骤f、如果则停止计算;否则置其中,
步骤g、进行一维搜索,求解一维问题:maxφ(a)=F(a(k)+αd(k)),获得αk,置a(k)=a(k)+akd(k);令k=k+1,转去执行步骤f,并将计算结果记为a(n);Step g, perform a one-dimensional search to solve the one-dimensional problem: maxφ(a)=F(a (k) +αd (k) ), obtain α k , set a (k) =a (k) +a k d ( k) ; Make k=k+1, turn to execute step f, and calculate the result as a (n) ;
步骤h、计算a(n)的适应度函数,并据a(n)生成一个个体,加入种群中,替换种群中适应度最小的个体,转去执行步骤c;Step h, calculate the fitness function of a ( n ), and generate an individual according to a (n) , add it to the population, replace the individual with the smallest fitness in the population, and go to step c;
步骤i、迭代结束,输出最优解,设为滤波器系数。Step i, the iteration ends, and the optimal solution is output, which is set as the filter coefficient.
上述基于本发明的混合遗传算法,仅需对种群的中心个体交替执行遗传算法和共轭梯度法,这样就可以充分利用遗传算法的全局搜索特性和共轭梯度法的快速收敛特性,使算法能快速地收敛到最优解。The above-mentioned hybrid genetic algorithm based on the present invention only needs to alternately execute the genetic algorithm and the conjugate gradient method to the central individual of the population, so that the global search characteristic of the genetic algorithm and the fast convergence characteristic of the conjugate gradient method can be fully utilized, so that the algorithm can quickly converge to the optimal solution.
步骤S40,根据所述滤波器系数获取满足所述实际滤波需求的FIR数字滤波器。Step S40, obtaining an FIR digital filter that satisfies the actual filtering requirement according to the filter coefficients.
在本步骤中,主要是根据前面步骤计算得到的滤波器系数,设计满足实际需求的最优的FIR数字滤波器。In this step, the optimal FIR digital filter that meets actual needs is designed mainly based on the filter coefficients calculated in the previous steps.
综合上述FIR数字滤波器设计方法,根据实际的不同需求,采用加权的方式进行滤波器的设计,对旁瓣和主瓣进行加权求和,可根据实际的设计需求对主瓣和旁瓣的性能需求进行自动调节,从而可得到不同的性能的滤波器设计;在求解算法中,面对极小化问题,采用混合遗传算法,将进化算法中的遗传算法与传统的共轭梯度算法相结合,从而可全局快速搜索最优的滤波系数。该算法充分利用遗传算法的全局搜索能力和共轭梯度法的快速局部搜索能力,加快了遗传算法的收敛速度,提升了遗传算法的搜索精度。从而可得出最优滤波器设计系数,根据滤波系数,可获取满足实际需求的最优的滤波器。Based on the above-mentioned FIR digital filter design method, according to different actual needs, the filter design is carried out in a weighted manner, and the side lobes and main lobes are weighted and summed, and the performance of the main lobes and side lobes can be adjusted according to the actual design requirements. The requirements are automatically adjusted, so that filter designs with different performances can be obtained; in the solution algorithm, in the face of the minimization problem, a hybrid genetic algorithm is used to combine the genetic algorithm in the evolutionary algorithm with the traditional conjugate gradient algorithm. Therefore, the optimal filter coefficient can be quickly searched globally. This algorithm makes full use of the global search ability of genetic algorithm and the fast local search ability of conjugate gradient method, which accelerates the convergence speed of genetic algorithm and improves the search accuracy of genetic algorithm. Therefore, the optimal filter design coefficients can be obtained, and according to the filter coefficients, the optimal filter that meets the actual needs can be obtained.
参考图3所示,图1为本发明FIR数字滤波器设计系统结构示意图;主要包括:With reference to shown in Fig. 3, Fig. 1 is the FIR digital filter design system structural representation of the present invention; Mainly comprise:
数学建模模块10,用于根据滤波器设计需求对FIR数字滤波器进行建模获得滤波器的数学模型;Mathematical modeling module 10, is used for modeling FIR digital filter according to filter design requirement and obtains the mathematical model of filter;
条件细化模块20,用于根据所述数学模型对滤波器的参数限制条件进行细化获得条件加权模型;A condition refinement module 20, configured to refine the parameter constraints of the filter according to the mathematical model to obtain a condition weighted model;
模型求解模块30,用于利用遗传算法与最小二乘法求解所述条件加权模型获得最优的滤波器系数;Model solving module 30, for utilizing genetic algorithm and least square method to solve described conditional weighting model to obtain optimal filter coefficient;
滤波器设计模块40,用于根据所述滤波器系数获取满足所述实际滤波需求的FIR数字滤波器。The filter design module 40 is configured to obtain an FIR digital filter that meets the actual filtering requirements according to the filter coefficients.
在一个实施例中,数学建模模块10进一步用于:In one embodiment, the mathematical modeling module 10 is further used to:
根据滤波器设计需求输入建立加权的滤波设计模型:According to the input of filter design requirements, a weighted filter design model is established:
E(ejw)=Hd(ejw)-H(ejw).E(e jw )=H d (e jw )-H(e jw ).
式中,Hd(ejw)表示理想滤波器频率响应,H(ejw)表示实际得到的滤波器频率响应,E(ejw)表示频率响应误差;In the formula, H d (e jw ) represents the ideal filter frequency response, H(e jw ) represents the actual filter frequency response, and E(e jw ) represents the frequency response error;
计算均方差方程:Compute the mean square error equation:
式中,e2表示均方误差,其中:In the formula, e 2 represents the mean square error, where:
根据均方差方程获取滤波器的数学模型:Obtain the mathematical model of the filter according to the mean square error equation:
其中:in:
ξ=[h(0),h(1),…h(N-1)]T,ξ=[h(0),h(1),…h(N-1)] T ,
H=[Hd(w1),Hd(w2),…,Hd(wM)]H=[H d (w 1 ),H d (w 2 ),…,H d (w M )]
式中,表示二范数,wk(k=0,1,…,M-1)表示在[-π,π]上的M个频率采样点,h(n),n=0,1,…,N-1为一组使得公式:获得的取值为最小的滤波器设计参数值。In the formula, Represents the two-norm, w k (k=0,1,...,M-1) represents M frequency sampling points on [-π,π], h(n),n=0,1,...,N -1 for a group makes the formula: The obtained value is the minimum filter design parameter value.
在一个实施例中,条件细化模块20进一步用于:In one embodiment, the condition refinement module 20 is further used for:
建立滤波器实际频率响应相关的权函数矩阵A:Establish the weight function matrix A related to the actual frequency response of the filter:
其中,A为权函数矩阵, Among them, A is the weight function matrix,
根据权函数矩阵A计算加权模型: Calculate the weighted model according to the weight function matrix A:
式中,表示二范数,F为目标函数。In the formula, Indicates the two-norm, and F is the objective function.
在一个实施例中,模型求解模块30进一步用于:In one embodiment, the model solving module 30 is further used for:
根据所述加权模型建立遗传算法的模型;Establishing a model of a genetic algorithm according to the weighted model;
将所述模型的种群的中心设为共轭梯度算法处理的初始搜索点;其中,所述中心为种群个体的平均值,表达式为:m为种群个数,个体分别为ai∈Rn,i=1,2,…,m;The center of the population of the model is set as the initial search point of the conjugate gradient algorithm; wherein, the center is the average value of the population individual, and the expression is: m is the number of populations, and the individuals are a i ∈ R n , i=1,2,...,m;
执行n步共轭梯度算法处理获得结果a(n),计算a(n)的适应度函数,并据a(n)生成一个个体,将该个体加入到种群中替换适应度值最小的个体;Execute n-step conjugate gradient algorithm processing to obtain the result a (n) , calculate the fitness function of a ( n), and generate an individual according to a (n) , add the individual to the population to replace the individual with the smallest fitness value;
循环执行下一次遗传算法迭代处理和共轭梯度算法处理步骤,直至求解出加权模型的最优解,设为滤波器系数。The next genetic algorithm iterative processing and the conjugate gradient algorithm processing steps are executed in a loop until the optimal solution of the weighted model is obtained, which is set as the filter coefficient.
进一步地,模型求解模块30用于求解所述条件加权模型的算法具体包括:Further, the algorithm used by the model solution module 30 to solve the conditional weighted model specifically includes:
a、初始化产生初始种群;其中,设置种群规模为m,交叉概率为pc,变异概率为pm,设置迭代次数为n;a. Initialize and generate the initial population; among them, set the population size as m, the crossover probability as p c , the mutation probability as p m , and the number of iterations as n;
b、计算个体适应度函数F;b. Calculate the individual fitness function F;
c、执行交叉算子和变异算子;c. Execute crossover operator and mutation operator;
d、计算种群的中心a0;d. Calculate the center a 0 of the population;
e、将a0设为共轭梯度算法处理的初始搜索点;其中,设置k=1,设置迭代次数n0,设置精度要求ε,并执行如下算法处理:e. Set a 0 as the initial search point for the conjugate gradient algorithm processing; among them, set k=1, set the number of iterations n 0 , set the accuracy requirement ε, and perform the following algorithm processing:
f、如果则停止计算;否则置其中,
g、进行一维搜索,求解一维优化问题:maxφ(α)=F(a(k)+αd(k)),获得αk,置a(k)=a(k)+αkd(k);令k=k+1,转去执行步骤f,并将计算结果记为a(n);g. Carry out one-dimensional search and solve one-dimensional optimization problem: maxφ(α)=F(a (k) +αd (k) ), get α k , set a (k) =a (k) +α k d ( k) ; Make k=k+1, turn to execute step f, and calculate the result as a (n) ;
h、计算a(n)的适应度函数,生成新的种群,即根据a(n)生成一个个体,加入种群中,替换种群中适应度最小的个体,转去执行步骤c;h. Calculate the fitness function of a ( n ) to generate a new population, that is, generate an individual according to a (n) , add it to the population, replace the individual with the smallest fitness in the population, and go to step c;
i、迭代结束,输出最优解,设为滤波器系数。i. After the iteration, output the optimal solution and set it as the filter coefficient.
本发明的FIR数字滤波器设计系统与本发明的FIR数字滤波器设计方法一一对应,在上述FIR数字滤波器设计方法的实施例阐述的技术特征及其有益效果均适用于FIR数字滤波器设计系统的实施例中,特此声明。The FIR digital filter design system of the present invention corresponds to the FIR digital filter design method of the present invention one by one, and the technical characteristics and beneficial effects set forth in the embodiments of the above-mentioned FIR digital filter design method are applicable to the FIR digital filter design Embodiments of the system are hereby declared.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the descriptions thereof are relatively specific and detailed, but should not be construed as limiting the patent scope of the present invention. It should be pointed out that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410065055.0A CN103888104B (en) | 2014-02-25 | 2014-02-25 | Method and system for designing FIR digital filter |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410065055.0A CN103888104B (en) | 2014-02-25 | 2014-02-25 | Method and system for designing FIR digital filter |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103888104A CN103888104A (en) | 2014-06-25 |
CN103888104B true CN103888104B (en) | 2017-01-25 |
Family
ID=50956845
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410065055.0A Active CN103888104B (en) | 2014-02-25 | 2014-02-25 | Method and system for designing FIR digital filter |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103888104B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104270118B (en) * | 2014-09-03 | 2017-05-03 | 浙江理工大学 | Design method of filter coefficient in filter-and-forward relay network |
CN106100608B (en) * | 2015-05-01 | 2019-02-05 | 中国人民解放军海军大连舰艇学院 | Weighted Least Squares Spatial Matrix Filter Design Method |
CN105677957B (en) * | 2015-12-31 | 2020-06-05 | 中国人民解放军93209部队 | Design method and device for approximate accurate reconstruction cosine modulation filter bank |
CN106054318B (en) * | 2016-06-28 | 2019-04-02 | 上海大学 | The design method of one-dimensional membrane cavity type unequal band width optical interleaver |
CN106374879A (en) * | 2016-11-21 | 2017-02-01 | 河海大学常州校区 | An Effective FIR Filter Optimization Method Based on CSE |
CN107733517B (en) * | 2017-09-22 | 2019-11-15 | 中国人民解放军国防科技大学 | Satellite navigation channel equalization method based on small number of low-order FIR filters |
CN109921763B (en) * | 2019-02-26 | 2021-10-22 | 华南理工大学 | A kind of FIR filter for reducing multiplier and its output calculation method |
CN113691238B (en) * | 2021-10-22 | 2022-03-15 | 南通海美电子有限公司 | Filter matching method and system based on genetic algorithm |
CN115200713B (en) * | 2022-07-14 | 2025-02-18 | 西安邮电大学 | Polarization parameter optimization method for full polarization imaging spectroscopy system based on genetic algorithm |
CN115542730A (en) * | 2022-11-02 | 2022-12-30 | 西南科技大学 | FIR digital filter parameter optimization method based on adaptive chaotic genetic algorithm |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101425152A (en) * | 2008-12-12 | 2009-05-06 | 湖南大学 | Design method for FIR filter based on learning rate changing neural net |
US8279984B1 (en) * | 2003-03-25 | 2012-10-02 | Marvell International, Ltd. | System and method for controlling gain and timing phase in a presence of a first least mean square filter using a second adaptive filter |
CN103152012A (en) * | 2013-03-04 | 2013-06-12 | 河海大学常州校区 | Far-infrared (FIR) filter designing method capable of reducing pass-band group delay error |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070153889A1 (en) * | 2006-01-04 | 2007-07-05 | Norton David E Jr | Application of leakage to an adaptive equalizer |
-
2014
- 2014-02-25 CN CN201410065055.0A patent/CN103888104B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8279984B1 (en) * | 2003-03-25 | 2012-10-02 | Marvell International, Ltd. | System and method for controlling gain and timing phase in a presence of a first least mean square filter using a second adaptive filter |
CN101425152A (en) * | 2008-12-12 | 2009-05-06 | 湖南大学 | Design method for FIR filter based on learning rate changing neural net |
CN103152012A (en) * | 2013-03-04 | 2013-06-12 | 河海大学常州校区 | Far-infrared (FIR) filter designing method capable of reducing pass-band group delay error |
Non-Patent Citations (2)
Title |
---|
基于自适应遗传算法 FIR 数字滤波器优化设计;黄猛等;《现代电子技术》;20100115;第2010年卷(第2期);参见摘要,第1节,第3节,第5节 * |
嵌入共轭梯度算子的遗传算法;郑洲顺等;《上饶师范学院学报》;20080630;第28卷(第3期);参见摘要,第5节 * |
Also Published As
Publication number | Publication date |
---|---|
CN103888104A (en) | 2014-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103888104B (en) | Method and system for designing FIR digital filter | |
EP3754521A1 (en) | Structural topology optimization method based on material-field reduction series expansion | |
Shahein et al. | A novel hybrid monotonic local search algorithm for FIR filter coefficients optimization | |
CN107272403A (en) | A kind of PID controller parameter setting algorithm based on improvement particle cluster algorithm | |
CN101425152B (en) | Design method for FIR filter based on learning rate changing neural net | |
CN102025344A (en) | FIR (Finite Impulse Response) filter design method and equipment thereof | |
CN110365314B (en) | Design method of separable two-dimensional FIR filter with sparse coefficient | |
Yang et al. | Fpnet: Customized convolutional neural network for fpga platforms | |
CN117993251A (en) | A high-fidelity stress calculation method for structural topology optimization under fixed grid | |
CN109344969B (en) | Neural network system, training method thereof, and computer readable medium | |
CN105929865A (en) | Linear servo system mechanical resonance control method | |
CN109687843A (en) | A kind of algorithm for design of the sparse two-dimentional FIR notch filter based on linear neural network | |
CN105787204A (en) | Design method of two-dimensional double prototype completely-oversampled DFT (discrete Fourier transform) modulated filter bank | |
CN104156604B (en) | Filter boundary frequency band control method and device based on genetic algorithm | |
CN108108812A (en) | For the efficiently configurable convolutional calculation accelerator of convolutional neural networks | |
Zhao et al. | A fast matrix iterative technique for the WLS design of 2-D quadrantally symmetic FIR filters | |
Mandal et al. | FIR band stop filter optimization by improved particle swarm optimization | |
WO2020000979A1 (en) | Modeling method for spatial filter | |
Jiang et al. | Reduced multiscale computation on adapted grid for the convection-diffusion Robin problem | |
Zaplatilek et al. | Practice utilization of algorithms for analog filter group delay optimization | |
Soleimani | Combine particle swarm optimization algorithm and canonical sign digit to design finite impulse response filter | |
Wang et al. | A novel neural networks-based approach for designing FIR filters | |
CN105243207A (en) | Particle swarm optimization (PSO) algorithm based antenna layout optimization on single frequency point | |
Agrawal et al. | Hybrid method based optimized design of digital IIR filter | |
Dong et al. | High-speed FPGA implementation of an improved LMS algorithm |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |