stm32 带通滤波器_【安富莱——DSP教程】第37章 FIR滤波器的实现

本文介绍了如何在STM32上使用arm_fir_f32函数设计和实现FIR低通滤波器。通过fdatool获取滤波器系数,然后在开发板上应用该函数处理50Hz和200Hz正弦波混合信号,实现实时滤波。实验结果表明,滤波器能够有效地滤除高频成分,保留低频信号。
摘要由CSDN通过智能技术生成

37.3FIR低通滤波器设计

本章使用的FIR滤波器函数是arm_fir_f32。下面使用此函数设计FIR低通,高通,带通和带阻滤波器。37.3.1函数arm_fir_f32说明

函数定义如下:

void arm_fir_f32(

const arm_fir_instance_f32 * S,

float32_t * pSrc,

float32_t * pDst,

uint32_t blockSize)

参数定义:

[in]   *S       points to an instance of the floating-point FIR filter structure.

[in]  *pSrc     points to the block of input data.

[out] *pDst     points to the block of output data.

[in]  blockSize  number of samples to process per call.

return     none.

注意事项:

结构arm_fir_instance_f32的定义如下(在文件arm_math.h文件):

typedef struct

{

uint16_t numTaps;     /**< number of filter coefficients in the filter. */

float32_t *pState;      /**< points to the state variable array. The array is of length numTaps+blockSize-1. */

float32_t *pCoeffs;    /**< points to the coefficient array. The array is of length numTaps. */

} arm_fir_instance_f32;

1. 参数pCoeffs指向滤波因数,滤波因数数组长度为numTaps。但要注意pCoeffs指向的滤波因数应该按照如下的逆序进行排列:

{b[numTaps-1],  b[numTaps-2],  b[N-2],  ...,  b[1],  b[0]}

但满足线性相位特性的FIR滤波器具有奇对称或者偶对称的系数,偶对称时逆序排列还是他本身。

2. pState指向状态变量数组,这个数组用于函数内部计算数据的缓存。

3. blockSize 这个参数的大小没有特殊要求,用户只需保证大于1小于等于采样点个数即可。37.3.2fdatool获取低通滤波

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值