| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 813 人关注过本帖
标题:重写 function low-pass filter
取消只看楼主 加入收藏
yuchao130
Rank: 2
等 级:论坛游民
帖 子:20
专家分:32
注 册:2014-2-19
结帖率:80%
收藏
已结贴  问题点数:50 回复次数:2 
重写 function low-pass filter
Applies a low-pass filter to sequences of valid temperature readings for consecutive times.
 * If a non-valid temperature reading is found, the filter should restart at the next valid
 * temperature reading. The following describes the low-pass filter used:
 *
 *    filtered_output(0) = unfiltered_input(0)
 *    filtered_output(n) = 0.9375 * filtered_output(n-1) + 0.0625 * unfiltered_input(n)
 *
 */
void LowPassFilter(ACTempData acTemps[])
{
    int a; // The first valid data.
    int i;
    int n;
    a = 0;
    i = 0;
    n = 1;
    while(acTemps[a].valid != 1)
        ++a;
    for(i = a; i < MinPerDay; ++i){
        n = 1;
        while(i != a && acTemps[i-n].valid == 0)
            ++n;
        if(i != a && acTemps[i].valid == 1){
            acTemps[i].temperature = 0.9375 * acTemps[i-n].temperature + 0.0625 * acTemps[i].temperature;
        }
    }
}
我实在没有办法了,只能求助论坛了。如何用另一种形势,比如改while 等等来重写这个function

[ 本帖最后由 yuchao130 于 2014-9-12 03:03 编辑 ]
搜索更多相关主题的帖子: filter reading function following describes 
2014-09-11 19:29
yuchao130
Rank: 2
等 级:论坛游民
帖 子:20
专家分:32
注 册:2014-2-19
收藏
得分:0 
回复 2 楼 枫 __________
我弄错了,我这个function弄明白了一部分。
2014-09-12 03:03
yuchao130
Rank: 2
等 级:论坛游民
帖 子:20
专家分:32
注 册:2014-2-19
收藏
得分:0 
回复 3 楼 erty1001
我只列出了整个程序的其中一个function,所以根本说不通。。。。。。。
2014-09-12 03:05
快速回复:重写 function low-pass filter
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016352 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved