Practical Analog and Digital Filter Design

Appendix H: C Code for FIR Filter Design

The design of digital FIR filters is accomplished by Calc_DigFIR_Coefs shown in Listing H.1. (All of the functions necessary to implement that section of the project can be found in the \C_CODE\FILTER\F_DESIGN.C module on the software disc.) In this function, we see that all of the necessary steps in the design process are accomplished by the functions called from Calc_DigFIR_Coefs. In addition, the user is given an opportunity to adjust the length of the filter after it has been estimated. This option is necessary since the FIR filter length cannot be calculated exactly. Once the length has been accepted or changed, memory can be allocated for the filter coefficients.

Listing H.1: Calc_DigFIR_Coefs function.
/*====================================================  Calc_DigFlR_Coefs() - calcs the digital FIR coefs  Prototype:  int Calc_DigFIR_Coefs(Filt_Params *FP);  Return:     error value  Arguments:  FP - ptr to struct holding filter params====================================================*/int Calc_DigFIR_Coefs(Filt_Params *FP){ char ans;  int Error;        /*  error value */  double beta;      /*  parameter for Kaiser window */  /*  Estimate the length (order) of filter.      Get beta for Kaiser window, if needed. */  beta = Estm_Filter_Len(FP);  /*  See if user wants to adjust estimated length */  printf("\n Filter length is estimated as %d.", FP->order);  ans = Get_YN("\n Do you wish to change it? (Y/N):");  if(ans == 'Y')  { FP->order =...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: IC Electronic Filters
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.