差分方程c语言,filter函数 C语言差分方程

本文介绍了如何使用C语言实现MATLAB中的filter函数,通过给出的差分方程进行数字滤波。在C语言中,详细展示了滤波过程的代码,但指出从y[1]开始,C语言实现的结果与MATLAB的filter函数结果存在差异,探讨了可能存在的问题和原因。
摘要由CSDN通过智能技术生成

Matlab里面的filter函数的实现说明

%FILTER One-dimensional digital filter.

%   Y = FILTER(B,A,X) filters the data in vector X with the

%   filter described by vectors A and B to create the filtered

%   data Y.  The filter is a "Direct Form II Transposed"

%   implementation of the standard difference equation:

%

%   a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)

%                         - a(2)*y(n-1) - ... - a(na+1)*y(n-na)

%

%   If a(1) is not equal to 1, FILTER normalizes the filter

%   coefficients by a(1).

MATLAB里面运行的表达式:y = filter(b,1,x);

C语言实现的差分方程:

y[0] = b[0]*x[0];

y[1] = b[0]*x[1] + b[1]*x[0] - y[0];

y[2] = b[0]*x[2] + b[1]*x[1] + b[2]*x[0] - y[0] - y[1];

y[3] = b[0]*x[3] + b[1]*x[2] + b[2]*x[1] + b

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值