设计低通FIR滤波器。通带边缘频率10KHz,阻带边缘频率22KHz,阻带衰减75dB,采样频率50KHz窗函数选定:阻带衰减75dB,选择blackman窗截止频率:2pi*(10+(22-10)/2)/50=0.64pi窗函数长度:blackman窗的过渡带宽为5.98,单位为2pi/N,而要设计的低通滤波器的过渡带宽为2pi*12/50=0.48pi,二者相等,得N=24.9,取25。理想低通滤波器脉冲响应:h1[n]=sin(nΩ1)/n/pi=sin(0.64pi*n)/n/pi窗函数为:w[n]=0.42-0.5cos(2pi*n/24)+0.8cos(4pi*n/24)则滤波器脉冲响应为:h[n]=h1*w[n]|n|=12h[n]=0|n|12#includeDSP281x_Device.hDSP281xHeaderfileIncludeFile#includeDSP281x_Examples.hDSP281xExamplesIncludeFile#includef2812a.h#includemath.h#defineFIRNUMBER25#defineSIGNAL1F1000#defineSIGNAL2F4500#defineSAMPLEF10000#definePI3.1415926floatInputWave();floatFIR();floatfHn[FIRNUMBER]={0.0,0.0,0.001,-0.002,-0.002,0.01,-0.009,-0.018,0.049,-0.02,0.11,0.28,0.64,0.28,-0.11,-0.02,0.049,-0.018,-0.009,0.01,-0.002,-0.002,0.001,0.0,0.0};floatfXn[FIRNUMBER]={0.0};floatfInput,fOutput;floatfSignal1,fSignal2;floatfStepSignal1,fStepSignal2;floatf2PI;inti;floatfIn[256],fOut[256];intnIn,nOut;main(void){nIn=0;nOut=0;f2PI=2*PI;fSignal1=0.0;fSignal2=PI*0.1;fStepSignal1=2*PI/30;fStepSignal2=2*PI*1.4;while(1){fInput=InputWave();fIn[nIn]=fInput;nIn++;nIn%=256;fOutput=FIR();fOut[nOut]=fOutput;nOut++;if(nOut=256){nOut=0;/*请在此句上设置软件断点*/}}}floatInputWave(){for(i=FIRNUMBER-1;i0;i--)fXn[i]=fXn[i-1];fXn[0]=sin(fSignal1)+cos(fSignal2)/6.0;fSignal1+=fStepSignal1;if(fSignal1=f2PI)fSignal1-=f2PI;fSignal2+=fStepSignal2;if(fSignal2=f2PI)fSignal2-=f2PI;return(fXn[0]);}floatFIR(){floatfSum;fSum=0;for(i=0;iFIRNUMBER;i++){fSum+=(fXn[i]*fHn[i]);}return(fSum);}