- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在嵌入式微 Controller (TMS320F28069) 上进行编程,这是一个 32 位浮点 MCU。我正在研究一些示例项目,其中一个在 ADC 采样数据上实现了一个简单的 FIR 滤波器。
假设 ADC 缓冲区有 10 个元素。假设过滤器的长度为 3 (FILTER_LEN=3
)。过滤器的实现非常简单,它从延迟链的末尾开始,然后移动到开头。
float32 ssfir(float32 *x, float32 *a, Uint16 n)
{
Uint16 i; // general purpose
float32 y; // result
float32 *xold; // delay line pointer
/*** Setup the pointers ***/
a = a + (n-1); // a points to last coefficient
x = x + (n-1); // x points to last buffer element
xold = x; // xold points to last buffer element
/*** Last tap has no delay line update ***/
y = (*a--)*(*x--);
/*** Do the other taps from end to beginning ***/
for(i=0; i<n-1; i++)
{
y = y + (*a--)*(*x); // filter tap
*xold-- = *x--; // delay line update
}
/*** Finish up ***/
return(y);
}
现在,以下是 ADC 循环缓冲区的实现方式。
//---------------------------------------------------------------------
interrupt void ADCINT1_ISR(void) // PIE1.1 @ 0x000D40 ADCINT1
{
static float32 *AdcBufPtr = AdcBuf; // Pointer to ADC data buffer
static float32 *AdcBufFilteredPtr = AdcBufFiltered; // Pointer to ADC filtered data buffer
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Must acknowledge the PIE group
//--- Manage the ADC registers
AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; // Clear ADCINT1 flag
//--- Read the ADC result:
*AdcBufPtr = ADC_FS_VOLTAGE*(float32)AdcResult.ADCRESULT0;
//--- Call the filter function
xDelay[0] = *AdcBufPtr++; // Add the new entry to the delay chain
*AdcBufFilteredPtr++ = ssfir(xDelay, coeffs, FILTER_LEN);
//--- Brute-force the circular buffer
if( AdcBufPtr == (AdcBuf + ADC_BUF_LEN) )
{
AdcBufPtr = AdcBuf; // Rewind the pointer to the beginning
AdcBufFilteredPtr = AdcBufFiltered; // Rewind the pointer to the beginning
}
}
xDelay
是一个长度为 FILTER_LEN
的 float32 数组,用 0 初始化,coeffs
是一个长度为 FILTER_LEN
的 float32 数组> 使用滤波器系数进行初始化。
我的问题是,这里发生了什么:
//--- Call the filter function
xDelay[0] = *AdcBufPtr++; // Add the new entry to the delay chain
*AdcBufFilteredPtr++ = ssfir(xDelay, coeffs, FILTER_LEN);
值如何存储在 xDelay[1]
或 xDelay[2]
中?他们的实现似乎工作正常,但我没有关注旧数据如何推回到 xDelay 数组中。
最佳答案
在 ssfir() 函数中,以下行对 xDelay 数组中的元素进行洗牌
*xold-- = *x--; // delay line update
该行位于 for 循环中,因此 [1] 元素被复制到 [2],然后 [0] 元素被复制到 [1],因为尽管有 for 循环计数,x 和 xold 指针还是递减向上
关于用 C 语言实现 FIR 滤波器的循环缓冲区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22749058/
我正在挖掘一些关于用 C++ 从我的 IQ 数据样本中过滤噪音的信息。 我了解到这可以通过使用一个简单的过滤器来完成,该过滤器计算最后几个数据样本的平均值并将其应用于当前样本。 您是否对这种过滤有更多
我正在尝试在 STM32F407 微 Controller 上实现 60kHz 带通滤波器,但遇到了一些问题。我在 MATLABs fdatool 的帮助下生成了过滤器,然后也在 MATLAB 中对其
有谁知道是否可以将以前的输出值传递给 Matlab 中的 FIR 滤波器?我想这样做是因为我有大量数据(> 300Gb),我想对其进行过滤和下采样。如果我在 FIR 函数中使用标准的 [b,a] 系数
我正在尝试使用 vDSP_desamp()例程对不断捕获的音频信号执行下采样。根据 Accelerate-framework 文档,此例程执行 FIR 滤波和抽取。 但是我有一个冲突,因为 API 没
我有一个幅频响应点列表。振幅以分贝为单位给出。 任务是将此 AFR 列表导出为某些硬件 DSP 设备的一组系数。我知道此设备的文件格式。该设备的规范表明它需要 12288 个系数,并且 DSP 有 2
我想制作一个 FIR 滤波器。我有一个系数数组 (buffer[size]) 和一个数据数组 (filter[size_filter])。我必须在两个数组之间进行卷积: for(j = 0;j < s
我想在 Python 中通过窗口创建一个基本的高通 FIR 滤波器。 我的代码在下面并且是故意惯用的 - 我知道你可以(很可能)用 Python 中的一行代码完成它,但我正在学习。我使用了一个带有矩形
我已经在 Haskell 中实现了一个 FIR 滤波器。我不太了解 FIR 滤波器,我的代码很大程度上基于现有的 C# 实现。因此,我觉得我的实现有太多的 C# 风格,而不是真正的 Haskell 风
我需要制作一个简单的带通音频滤波器。现在我使用了这个简单的 C++ 类:http://www.cardinalpeak.com/blog/a-c-class-to-implement-low-pass
我试图在我的应用程序中添加 Firebase 实时数据库 功能,但我意识到我没有将它放入我的 pod 文件。 这就是我所做的,我添加了 'Firebase/Database' 并运行了 pod upd
我正在使用 FIR 滤波器对音频进行过采样。这是一个简单的典型窗口 sinc,即一个被截断和窗口化的 sinc 函数。像往常一样,它需要过去和“ future ”的样本才能工作。实际上,这意味着音频输
我正在嵌入式微 Controller (TMS320F28069) 上进行编程,这是一个 32 位浮点 MCU。我正在研究一些示例项目,其中一个在 ADC 采样数据上实现了一个简单的 FIR 滤波器。
我最近查看了 Google Firebase 的 quickstart-js/firestore/ 存储库中的代码,当我在 index.html 中遇到以下 html 时: 63
目前我正在尝试实现 FIR 低通滤波器。 FIR 系数在 MATLAB 中计算。现在我需要用 C++ 实现 FIR 算法。 我将一个类定义为过滤器,将 FIR 的一个函数定义为: double * F
我正在用 C 实现 FIR 低通滤波器。在 MATLAB 中生成了一些系数,我用它们来计算输出。音频来自 Zynq Zedboard,是实时的。如果我运行该应用程序,我会听到很多噪音。但我不知道信号是
我有一个用 C 语言实现 FIR 滤波器的家庭作业,我想知道您是否认为我理解正确。我认为解决问题的程序是: #include float FIRfloats[5]; void floatFIR(fl
FIR 滤波器有一个算法,但它是 float : FIR filter implementation in C programming 如果我想要一个符合此规范的定点算法,我该怎么做? the FIR
我正在尝试对 FIRDatabaseQuery 对象执行内部联接。 下面是数据库结构。我有一些链接到帖子评论的帖子。我正在尝试获取特定用户添加评论的所有帖子: { "posts" : {
我是 DSP 的新手,我有一个关于信号过滤的问题。正如我在 Internet 上看到的,IIR 和 FIR 滤波器通常用于过滤信号。此外,我还看到了另一种过滤信号的方法,即:频域滤波器(如在 Aqui
我正在尝试在 CUDA 中实现 FIR(有限脉冲响应)滤波器。我的方法很简单,看起来有点像这样: #include __global__ void filterData(const float *d
我是一名优秀的程序员,十分优秀!