项目简介
本项目是基于C语言开发的FIR(有限脉冲响应)滤波器系数计算工具,用于为嵌入式程序计算不同类型的FIR滤波器系数。用户可通过命令行交互设置滤波器相关参数,最终获得滤波器系数及对应的冲激响应图像。
项目的主要特性和功能
- 支持低通、高通、带通、带阻四种滤波器类型。
- 提供矩形、三角、韦尔奇等十二种窗函数类型。
- 可通过命令行交互设置滤波器类型、窗函数、采样频率、阶数以及截止频率等参数。
- 以
.txt
文件输出滤波器系数,以.png
文件输出滤波器的冲激响应图像。
安装使用步骤
环境准备
假设用户已下载本项目的源码文件,需确保计算机已安装C语言编译器(如gcc)。若在Linux系统中未安装gcc编译器,可执行以下命令进行安装:
sudo apt install build-essential
sudo apt-get install manpages-dev
运行程序
- Windows用户:直接打开
FIR_filter_coeff.exe
程序。 - Linux用户:在文件所在位置打开终端,输入以下命令运行编译好的C程序:
./FIR_fiter_coeff_cal
输入参数示例
- 低通滤波器(汉宁窗,采样频率100Hz,128阶,截止频率2.2Hz)
enter the filter type window Fs order= lowpass hann 100 128 !enter the lowpass frequency fc = 2.2
- 高通滤波器(布莱克曼窗,采样频率100Hz,64阶,截止频率10Hz)
enter the filter type window Fs order= highpass blackman 100 64 enter the highpass frequency fc = 10
- 带通滤波器(布莱克曼 - 努塔尔窗,采样频率200Hz,84阶,通带频率2.2Hz - 4.4Hz)
enter the filter type window Fs order= bandpass blackmannuttall 200 84 enter the frequncy passband fc1 fc2 = 2.2 4.4
- 带阻滤波器(基塞尔窗,采样频率100Hz,64阶,阻带频率10Hz - 15Hz,阻带衰减60dB)
enter the filter type window Fs order= bandstop kiser 100 64 enter the frequncy stopband fc1 fc2 = 10 15 Enter stop-band attenuation [dB] = 60
查看输出
程序运行结束后,会生成 .txt
文件和 .png
文件,分别包含滤波器系数和冲激响应图像,可在相应目录中查看。
下载地址
点击下载 【提取码: 4003】【解压密码: www.makuang.net】