📄 wmsefilt.1e
字号:
.\" @(#)wmsefilt.1e 3.11 7/16/93 ESI.TH WMSE_FILT 1\-ESPS 7/16/93.ds ]W "\fI\s+4\ze\h'0.05'e\s-4\v'-0.4m'\fP\(*p\v'0.4m'\ Entropic Processing, Inc..SH NAMEwmse_filt \- design an FIR filter using the weighted mean square error criterion..sp.SH SYNOPSIS.B wmse_filt[.BI \-P " param_file"] [.BI \-n " filt_length"] [.BI \-d " d_file"] [.BI \-w " w_file"] [.BI \-x " debug_level"].I feafilt_file.sp.SH DESCRIPTION.PPThe program.I wmse_filtdesigns a linear phase finite impulse response (FIR) filter and prints the coefficients to the FEAFILT file.I feafilt_file.The user specifies the number of coefficients, the desiredfilter frequency response, and a weighting function. The program then finds theset of filter coefficients that minimizes the mean square error betweenthe desired response and the actual response, when weighted by the weightingfunction. In other words, for desired response .I D(f), and weighting function .I W(f),the program finds the filter .I H(f)which minimizes:.nf.ce.if t \{.EQint from -FS/2 to FS/2 ^{{left |^ D(f) - H(f) right | } sup 2 ~W(f)}~ df.EN\}.if n \{integral (from -FS/2 to FS/2) of |D(f)-H(f)|(squared) * W(f) df\}.fi.PPThe user may specify the desired frequency response and the weighting function in one of twomodes: \fIband\fR and \fIpointwise\fR..PPIn "band mode" the program assumes that the desired frequency response andthe weighting function are constant throughout a number of frequency bands.Bands are specified by parameters in the parameter file \fIparam_file\fR.The parameters are sampling frequency, filter length, number of bands,bandedges from 0 to half the sampling frequency in Hz, relativegain in each band, and weighting value of each band..PPIn "pointwise mode" the program allows the desired frequency response and the weighting function to be arbitrarily shaped and specified ata number of uniformly spaced points from zero to half the sampling frequency.The number of points must be one plus a power of two. The point values ofthe desired response and the weighting functionare specified in the ascii files .I d_fileand.I w_filerespectively. The first number in each of these filesshould be an integer which tells how many point values arein the file. The point values follow.Data in both files may be separated by any combinationof spaces or newlines. The desired response and the weighting function maybe in the same file, in which case the desired response comesfirst and the same file must be specified as both the.I d_fileand the.I w_fileabove..PPThe band mode is more accurate than the point mode if the desired frequency responseand the weighting function are of the constant region form described above..PPIf the output file name \fIfeafilt_file\fR is "-", then standard outputis written..PPAlso see the shell script \fIxfir_filt(1-ESPS)\fR that is a coverscript for this and other FIR filter design program..sp.SH OPTIONSThe following options are supported:.TP.BI \-P " param_file \fR[params]\fP"uses the parameter file.I param_filerather than the default, which is \fIparams\fP..TP.BI \-x " debug_level"A value of 0 (the default value) will cause.I wmse_filtto do its work silently, unless there is an error.A nonzero value will cause various parameters to be printed outduring program initialization..br.TP.BI \-n " filt_length"The number of coefficients in the filter. This option must be specifiedin pointwise mode. If this option is specified while in band mode, thiscommand-line option over-rides the parameter \fIfilt_length\fR in theparameter file..br.TP.BI \-d " d_file"The ascii file specifying the pointwise desired filter magnitude response. The firstnumber in this file should be an integer, telling how many pointsare in the file, which should be a power of two plus one. Using this optionwill place the user in pointwise mode, and the user must also specify a weighting function file using the.B \-w option or he will be prompted for it. Points on the desired response may be negative in order to achievenegative gain. For best results, .I d_fileshould contain a minimum of 513 or.I filt_length(whichever is larger) points..br.TP.BI \-w " w_file"The ascii file containing the pointwise weighting function. If the user is in the pointwise mode and does not specify .I w_filehe will be prompted for it. If he specifies "\-" for .I w_file,uniform weighting (i.e. everywhere equal to 1.0) will be used.Weighting function point values may not be negative.The first number in this file should be an integer telling how manypoint values are in the file, which should be equal to the number ofdesired response point values.For best results, this file should containa minimum of 513 or.I filt_length(whichever is larger) points..sp.SH ESPS PARAMETERSThe following ESPS parameters are supported in band mode..TP.I samp_freq - floatSpecifies the sampling frequency of the filter..TP.I filt_length - intSpecifies the length of the filter, must be an odd number..TP.I nbands - intSpecifies the number of bands. For example, for a bandpass filter,\fInbands\fR is \fI3\fR..TP.I band_edge[i] - floatSpecifies the \fIi\fRth bandedge in Hz. There are \fInbands+1\fR\fIband_edge[i]\fR parameters. The first bandedge \fIband_edge1\fR muststart with 0, and the last bandedge must end with the Nyquist rate.For example, for a bandpass filter withsampling frequency of 8000 Hz, bandedges at 0, 2000, and 4000 Hz.\fIBand_edge1\fR is 0, \fIband_edge2\fR is 2000, \fIband_edge3\fR is 4000..TP.I band[i]_des - floatSpecifies desired value for the \fIi\fRth band. For example, fora 3 band bandpass filter, \fIband1_des\fR is 0, \fIband2_des\fR is 1,and \fIband3_des\fR is 0;.TP.I band[i]_wt - floatSpecifies weighting value for the \fIi\fRth band. For example, fora 3 band bandpass filter with twice as much weight on the first band asthe other bands, \fIband1_wt\fR is 2, \fIband2_des\fR is 1, and \fIband3_des\fR is 2;.sp.SH ESPS COMMONThe common file is neither read nor written..SH ESPS HEADERA new FEAFILT header is created for the output file.The program fills in appropriate values in the common part of the headeras well as the following generic header items associated with the FEAFILT file type..sp.IP.I max_num.IPSet to.I filt_length..sp.IP.I max_denom.IPThis value is always set to 0..sp.IP.I define_pz, complex_filter.IPThese values are set to NO..sp.IP.I func_spec.IPThis value is set to BAND when in the band mode and POINT when inthe pointwise mode..sp.IP.I nbands.IPThis value is filled in appropriately when the band mode is used..sp.IP.I npoints.IPThis value is filled in appropriately when the pointwise mode is used..sp.IP.I type.IPThis value is set to FILT_ARB..sp.IP.I method.IPThis value is always set to WMSE..sp.IP.I bandedges.IPThis array is filled in appropriately for the band mode..sp.IP.I points.IPThis array is filled in appropriately for the pointwise mode..sp.IP.I gains.IPThis array is filled in with the band gains when in the band modeand with the point gains when in the pointwise mode..sp.IP.I wts.IPThis array is filled in with the band weights when in the band modeand with the point weights when in the pointwise mode..PPIn addition, the generic header items \fIsamp_freq\fR (type DOUBLE)and \fIdelay_samples\fP (type DOUBLE)are added to the header. \fIDelay_samples\fP is equal to (\fIfilt_length\fP \- 1)/2.This represents the delay to the center of the peak of the impulse response..sp.SH DIAGNOSTICSThe program will print an error message to standard error if the above specificationsare not met.The error messages are intended to be self explanatory..sp.SH FILESWhen.I debug_levelis nonzero, the program prints arrays to the files "harray", "warray", and"hwarray" in the format used by printarr (3-ESPS). These arrays are the timedomain values of the desired response, the weighting function, and theconvolution of these two responses, respectively..sp.SH SEE ALSOFEAFILT (5-ESPS), feafilter (1-ESPS), fft_filter (1-ESPS), impulse_resp (1-ESPS),notch_filter (1-ESPS), zero_pole (1-ESPS), atofilt (1-ESPS), iir_filt (1-ESPS),xpz (1-ESPS), zero_pole (1-ESPS), win_filt (1-ESPS), pkmc_filt (1-ESPS),cb_filt (1-ESPS), xfir_filt (1-ESPS).sp.SH BUGSThe program currently only designs filters with an odd number of coefficients..sp.SH AUTHORBrian Sublett; modified for ESPS 3.0 by David Burton; added parameter processing by Derek Lin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -