完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我确信有比我更有经验的人:当我需要100个采样/秒输出时,我正在读一个传感器,它给我1200个采样/秒的数据。实际上,我读了(@1200sps),我用50Hz低通滤波器(1200sps)进行滤波,然后每12个滤波器输出取一个采样。我的问题是:这是最有效的/更好的方法吗?我听说过FIR/IIR抽取过滤器,但如果我理解正确,在过滤器的末尾,我仍然每n个输出值取一个样本,那么与我的代码有什么不同?谢谢。
以上来自于百度翻译 以下为原文 Hi guys, I'm sure there is people with more experience than me about this: I'm reading a sensor giving me data at 1200 samples/second, when I need a 100 samples/second output. Actually I read (@1200 sps), I'm filtering with 50Hz low pass filter (at 1200 sps), then taking 1 sample every 12 filter output values. My question is: is this most efficient/better way to do this? I've heard about FIR/IIR decimation filters, but if I've correctly understood, at the end of filter I still take 1 sample every n output values, so what's the difference from my code? Thanks. |
|
相关推荐
12个回答
|
|
|
|
|
|
你的50Hz的过滤器很可能不是一个非常陡峭的过滤器,所以可能有一些能量超过50Hz。如果你简单地抽取每12次采样,这与100Hz的采样相同,50Hz以上的能量将被混叠回50Hz以下的频率。抽取FIR滤波器执行一个(可能)锐截止滤波器,并且只计算输出所需的采样,即:每第十二个样品在你的情况下。转换带宽(或多或少)与filter.edit的长度相反:我重新阅读您的帖子,发现您正在使用数字滤波器。正如我所提到的,抽取(多速率)滤波器节省了计算量。如果你使用IIR滤波器,它可能已经相当有效了。
以上来自于百度翻译 以下为原文 Your 50Hz filter is most likely not a very steep filter so there is likely to be some energy above 50Hz. If you simply decimate by taking every 12th sample it is the same as sampling at 100Hz and the energy above 50Hz will be aliased back into the frequencies below 50Hz. A decimation FIR filter performs a (possibly) sharp cut off filter and only calculates the samples that are required for output - i.e. every 12th sample in your case. The transition band width is (more or less) the inverse of the length of the filter. edit: I re-read your post and see that you are using a digital filter. As I mentioned, a decimation (multi-rate) filter saves on calculations. If you are using an IIR filter it is probably fairly efficient already. |
|
|
|
从什么角度来看最好的方法?别名过滤?通带平坦度?瞬态响应?CPU速度?该方法取决于任务。
以上来自于百度翻译 以下为原文 Best method from what point of view? Alias filtering? Pas***and flatness? Transient response? CPU speed? The method is depending on the task. |
|
|
|
这取决于你需要什么。最简单的方法是剔除多余的样本。平均值可能是也可能不是合适的。平均12个周期与瞬时读数不一样。比如说,你测量电压,它是在最后一次读数之前从0到5V。平均值会给你0.4V -很好的代表了正在进行的期间。瞬间阅读是5V最新的信息。什么更好?取决于你在做什么。
以上来自于百度翻译 以下为原文 It depends on what you need. The simplest way is to dismiss extra samples. Averaging may or may not be suitable. Average over 12 periods is not the same as momentary reading. Say, you measure voltage and it came from 0 to 5V just before the last reading. Average will give you 0.4V - good representation of what was going on during the period. Momentary reading is 5V - most up to date information. What is better? Depends on what you're doing. |
|
|
|
简单的一阶IIR很容易实现,只需要很少的资源。然后挑选每n个样品很容易。平均在固定数量的样品是废料。(我的一些前同事证明这很可悲:)表单的滑动平均非常有效,实现了IIR一阶低通。
以上来自于百度翻译 以下为原文 A simple first-order IIR is easy to implement requires little resources. Then picking every n-th sample is easy p.easy. Averaging over a fixed number of samples is scrap. (Some of my former colleagues proved that sad: ) A sliding average of the form A(n+1) = A(n) * (m-1)/m + E(n+1)/m A: Output, E: Input is quite efficient and implements an IIR first-order low pass. |
|
|
|
|
|
|
|
Simung123:是的-原则上,实际的实现往往有缩放因子加上一些舍入。我不确定这个简化的方程式能否涵盖所有的变型。
以上来自于百度翻译 以下为原文 @simong123: yes - in principle. Practical implementations tend to have a scaling factor plus eventually some rounding. I'm not sure whether the simplified equation can cover all the variants. |
|
|
|
好,比方说…关于抗混叠输入滤波器,当然我不会在50Hz下精确地滤波(事实上,我可以看到“标称”的50Hz数字滤波器-3dB@47Hz)。我将使用FIR滤波器,用于我的目的(我需要线性相位),但是为了测试,它不需要注意,所以使用FIR或IIR滤波器,我只需要不需要注意系数的数量(避免使用过多的系数来增加时钟频率)。通带平坦度和瞬态响应取决于滤波器类型,好,不管这个。然后我可以选择第n个值……(对于小的变化,平均是好的,但在我的情况下,我没有“慢”的信号作为温度)。因此,从以前的答案来看,我理解过滤和挑选第n个值就足够了,我猜想会有一些特殊的方法来做到这一点……
以上来自于百度翻译 以下为原文 Ok, let's say... about antialias input filter, of course I won't filter EXACTLY at 50 Hz (in fact I can see "nominal" 50Hz digital filters filtering -3dB @47Hz). I'll use a FIR filter for my purposes (I need linear phase), but for test it doesn't take care, so using FIR or IIR filter I just need to take care of number of coefficients (avoiding to increase clock frequency using too much coefficients). Pas***and flatness and transient response depends from filter type, ok, regardless this. Then I can pick n-th value.... (averaging is good with small changements but in my case I have not "slow" signals as temperature). So, from answers before, I understand filtering and picking n-th value would be enough good, I supposed there would be some particular way to do this.... |
|
|
|
你在DSPIC语言工具库中见过FiximimATE函数吗?http://WW1.Microchip…COM//DEVICEDOC/51456B.PDF?
以上来自于百度翻译 以下为原文 Have you seen FIRdecimate function in the dsPIC language tools libraries? http://ww1.microchip.com/.../devicedoc/51456b.pdf? |
|
|
|
这是一个巨大的过度杀戮。如果您已经有了一个前端模拟滤波器(无论如何您应该这样),那么进行FIR/IIR低通滤波实际上没有任何用处。简单地降低模拟滤波器频率(即RC滤波器中R或C越大)将起到完全相同的作用,只是更好。
以上来自于百度翻译 以下为原文 This is a huge overkill. If you already have a front end analog filter (as you should anyway) then doing FIR/IIR low-pass filtering doesn't really do anything useful. Simply decreasing analog filter frequency (that is bigger R or bigger C in RC filter) will do exactly the same, only better. |
|
|
|
如果你在输入端有足够的(随机的)噪声(~0.1至LSB),如果需要的话,你可以执行平均以获得一点或2的分辨率。
以上来自于百度翻译 以下为原文 This. And if you have sufficient (random) noise at the input (~0.5-1 LSB), you can perform averaging to gain a bit or 2 of resolution, if wanted. |
|
|
|
如果我正确理解OP,他需要更低的采样率,但保持相位尽可能线性。这就是为什么模拟RC滤波器的性能可能不够好的原因。我建议在DSPIC上使用FixDimimATE函数。它同时执行滤波和抽取。如果OP是幸运的,他将设计最合适的FIR滤波器。
以上来自于百度翻译 以下为原文 If I'm understanding the OP correctly he needs lower sample rate but preserve the phase as linear as possible. That is why an analog RC filter may perform not good enough. I'd recommend FIRdecimate function on a dsPIC. It performs both the filtering and the decimation the same time. If the OP is lucky he will design most appropriate FIR filter. |
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
609浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-29 02:30 , Processed in 1.613375 second(s), Total 99, Slave 83 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号