COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### IIR Filter Difference Equation Implementation

• Email
• Follow

Hi All,
I have a beginner-esqe question: all of my DSP literature shows the
IIR Difference Equation as:
y(n) = b(0)x(n) + b(1)x(n-1) + b(2)x(n-2) + ... + a(1)y(n-1) +
a(2)y(n-2) + ...

But then the C code implementations I see are something along the
lines:
FeedForwardVariable = (b[0] * x[n]) + (b[1] * x[n-1]) + (b[2] *
x[n-2]);
FeedBackwardVariable = (a[1] * y[n-1]) + (a[2] * y[n-2]) + (a[3] *
y[n-3]);
ResultVariable = FeedForwardVariable - FeedBackwardVariable;

The implementation uses a subtraction operation on the feed back
calculations that I don't see in the Difference Equation. Why is that?

I realize I'm setting myself up for a "Duh!!", but I'm really confused
why this is the case.

Thanks much,

Ben

 0
Reply stocksb (22) 7/10/2003 7:25:13 PM

See related articles to this posting

"Benjamin M. Stocks" <stocksb@ieee.org> wrote in message
> Hi All,
> I have a beginner-esqe question: all of my DSP literature shows the
> IIR Difference Equation as:
> y(n) = b(0)x(n) + b(1)x(n-1) + b(2)x(n-2) + ... + a(1)y(n-1) +
> a(2)y(n-2) + ...
>
> But then the C code implementations I see are something along the
> lines:
> FeedForwardVariable = (b[0] * x[n]) + (b[1] * x[n-1]) + (b[2] *
> x[n-2]);
> FeedBackwardVariable = (a[1] * y[n-1]) + (a[2] * y[n-2]) + (a[3] *
> y[n-3]);
> ResultVariable = FeedForwardVariable - FeedBackwardVariable;
>
> The implementation uses a subtraction operation on the feed back
> calculations that I don't see in the Difference Equation. Why is that?
>
> I realize I'm setting myself up for a "Duh!!", but I'm really confused
> why this is the case.
>
> Thanks much,
>
> Ben

y(n) = b(0)x(n) + b(1)x(n-1) + b(2)x(n-2) + ... - [a(1)y(n-1) + a(2)y(n-2) +
....]
n.b^
or

y(n) = b(0)x(n) + b(1)x(n-1) + b(2)x(n-2) + ... -a(1)y(n-1) -
a(2)y(n-2) - ...

is the normal expression for the difference equation.

Fred


 0

1 Replies
208 Views

Similar Articles

12/13/2013 1:39:02 AM
page loaded in 97238 ms. (0)

Similar Artilces:

Matlba butterworth IIR filter implementation
Hi all, I want to implement an butterworth low pass filter to filter the DC compone= nt of a signal inside a PLL - phase locked loop. I am processing sample-by-= sample. Therefore I have to filter the signal sample by sample (Not the who= le signal or block by block). I have implemented a filter to filter the who= le signal. But Im struggling to modify it make it work sample by sample bas= is. I highly appreciate if someone can advice me regarding this issue. I have i= ncluded the code Im using to filter. [b,a] =3D butter(10, 4*fc/Fs); % 10th Order butterworth filter coefficie...

implementing a difference equation
I have this equation: y(n) = x(n) + 2x(n-1) + x(n-2) + 0.8y(n-1) - 0.64y(n-2) I have to do the following tasks: I) Write a MATLAB function that implements the difference equation for the system (assuming null initial conditions). II) Use your function to calculate the response of the system to d(n-10) (delta function with the impulse located at n = 10). Plot (stem) the resulting output to n = 255. III) Use your function to obtain the output sequence that results when you use x = cos(pi*n*0.25) as the input. Plot (stem) the resulting output to n = 255. I have no idea how ...

Implement IIR Filter on FPGA
hi people, I'm designing filter system called IIR filter on the FPGA kit, but it doesn't work when I implement on FPGA. When i iput the signals, the output results seem to not get any thing. I do not know whether my source code is wrong or another reason. The FPGA kit operate normally with other sources which i loaded in the past. Can anyone give me some advices to test what parts in my project do not work or give me some idea to test anything. I am in the mess. I hope everyone can show me. I am looking forward hearing from people soon, Gordon Freeman wrote: > hi people, > ...

frequency response of iir filter-filtfilt implementation
Hi, Is there a simple way to determine the effective frequency response of the filtfilt implementation of an IIR bandpass filter ? I wish to confirm if I am getting twice the attenuation in the stop band as a result of the forward and backward filtering. I tried using an impulse input and compute the fft of the impulse response, but the fft doesn't look as expected. Is this the right way to determine the filter response or is there a simpler/better way? Please do advice. Thanks Matt On 4 Des, 13:40, "mathew.paul" <paulmathew...@gmail.com> wrote: > H...

Differences between different vendors implementations of std_logic_arith and the like
A while ago, someone posted a link to some documents that listed the different vendors implementations of std_logic_arith, unsigned and signed. I cant seem to find it now. Anyone have any clues? I think Mike Treseler posted it. Tricky wrote: > A while ago, someone posted a link to some documents that listed the > different vendors implementations of std_logic_arith, unsigned and > signed. I cant seem to find it now. Anyone have any clues? I think > Mike Treseler posted it. Do you mean the qualis cheat sheets? http://www.vhdl.org/rassp/vhdl/guidelines/vhdlqrc.pdf http://www.vhd...

Difference Equations
I has been using Matlab OdeSolvers to numerically solve differential equations (Continuous time). However, I'm trying to solve Difference Equations, but I d�n't know how can i do it in Matlab (Can I use OdeSolvers to do that?). For example, to solve: x(t+1)^3-5*x(t)^0.5=4*t Can anyone help me? Norman wrote: > > > I has been using Matlab OdeSolvers to numerically solve > differential > equations (Continuous time). However, I'm trying to solve > Difference > Equations, but I d�n't know how can i do it in Matlab (Can I use > OdeSolvers to do that?). For ...

Is there a difference between those implementations of compose?
I think lisp should have a builtin compose function, but since it hasn't, you will probably have to write your own. On the internet I found the following version: (defun compose (&rest fns) (if fns (let ((fn1 (car (last fns))) (fns (butlast fns))) #'(lambda (&rest args) (reduce #'funcall fns :from-end t :initial-value (apply fn1 args)))) #'identity)) But I think it could be easier written as: (defun compose (&rest funs) (if funs (reduce (lambda (f1 f2) (lambda (&rest x) (funcall f1 (apply f2 x)))) ...

Implement a simple filter
I wish to implement a simple C++ filter that reads from a file byte by byte and writes to an output files two bytes for each byte read according to some hardcoded table. I am looking for a very straightforward sample. It is pratically a binary filter. Thank you in advance. DdJ "Dario de Judicibus" <nospam@nowhere.it> wrote... > I wish to implement a simple C++ filter that reads from a file byte by byte > and writes to an output files two bytes for each byte read according to some > hardcoded table. I am looking for a very straightforward sample. It is > pratica...

IIR filter gain
Hi, I have the current 3rd order IIR filter: gain = 1789.111562 b = [1 3 3 1]; a = [1 -1.6009450356 0.9414772490 -0.1971027115]; I'm trying to implement this in fixed-point format, using DF1. I don't think I need to convert to Second-Order-Section as this is not an aggressive filter. The first step was to quantize the coefficients, and I get get by with 12 bits. Now I don't know what to do with this gain. If I do it at the input, I need to add ~11 LSB to keep decent SNR. If I do it at the output, well I need to add ~11 MSB or everything starts clipping within t...

Digital Filtering implementation
Hi pals ! Jere i am with a maybe very stupid question: I want to code a real time, equalizer (let's say 10th bands) followed by a crossover filter, in a digital way. So.. after having thought a while... i could consider two way to implement it : * The first, the "conventionnal way" : usinf normal IIR or FIR filters, to construct the EQ and Xover. this solution will lead to low delay and low computing CPU usage (as long as the order of filters are small of course !) * The other, that i think is better: To use a FFT on for exemple 512 (for ex) sample and with this, i can wo...

designing iir filter
hi, i have designed a 4th order IIR notch filter of 60Hz using the fdatool.Since i have to implement the filter in visual basic i had to quantize it. but the frequency response of the quantised filter and the reference filter wasn't matching so i had to use the second order sections of of the filter after which the frequency response was perfect.Now the problem is after applying the sections how do i implement the coefficients as i am not getting the concept of sections properly....how do i implemenet them in the transfer function as coefficients exported to the workspace shows two section...

saturation in iir filter
Hi all, i am currently implementing an iir filter on a arm processor that doesn' have a fractionnal multiplication. As i have read on this forum i divided my filter coefficient (bo b1 b2 a a2) by 2 if they are >1 to be able to perform a q1.15 by q1.1 multiplication the results of multiplications are therefore q2.30. I accumulate those multiplication in a 64 bit register , multiply th result by 2 to compensate for coeffs normalization ie: accum = b0\2*sample + b1\2*x[n-1] + b2\2*x[n-2]- a1\2*y[n-1] a2\2*y[n-2] accum += accum; (to compensate for dividing by 2 the coefficient) then i r...

PROBLEMS WITH IIR FILTER
GreetingS Folks, This is regarding the 4TH ORDER low pass elliptic II filter which I have been working on for quiet some time now and als unfortunately has been biting my bottom hard.To start with I had a .wa file from which I happened to have succesfully read the discrete dat values.For the coefficients I made use of the ellip command and hard code those values into my source code which happens to be in C.The compiler I a working on is VC++.The formulae I made use of was the difference equatio formulae or the DIRECT FORM as it is popularly known. >> *************...

Implementing a peaking filter
How do I get the signal at pi/3 positions alone from a DFT spectrum, using a peaking filter? I would like to have the MATLAB code , for the same, not just the explanation. Could anyone please help? ...

notch iir implementation
I have a similar problem described by Par in 2005. (Only different frequencies and sample size). I have signal of 10000 length that has undesired frequencies: f=0.0003, 0.0006 (f \in [0 1]) I want to get rid off. I build notch IIR and apply it. To test that it works I first created a synthetic signal (linear sum of harmonics) and apply filter on thi data. 1. I know that my IIR design is perfect. 2. I also know that to get zero linear phase I apply filter forw and bac sequentially. If my synthetic signal is long enough about 50000, I get very goo results in the middle part of the signa...

Notch filter implementation
Hii im a novice to matlab and im learning it especially the signal processing part I've taken a signal and want to eliminate one frequency from it using notch filter. I've written some code but the filtered output appears to be same s the input! >> Fs=1000; T=1/Fs; t=(0:Fs-1)*T; x=0.7*sin(2*pi*50*t)+sin(2*pi*120*t); subplot(2,1,1); plot(Fs*t(1:50),x(1:50)); wo = 50/(1000/2); bw = wo/35; [b,a] = iirnotch(wo,bw); y=filter(b,a,x); subplot(2,1,2); plot(Fs*t(1:50),y(1:50)); Can anyone help me with this?? "vinay " <vinay9023remove.this@gmail.com>...

Loop filtering Implementation
Hi , I am trying to implement loop filtering for a video codec. I am having trouble getting started, any help would be appreciated. CHeers, John ...

Difference-Differential Equations
Hi everybody, does anyone know if there are routines to determine difference-differential equations or as also called delay-differential equations? are there also algorithms available for the system identification of this type of equations? regards, timo In article <c14kbu$1u6$1@news.uni-kl.de>, "Timo Reis" <treis@rhrk.uni-kl.de> writes: >Hi everybody, >does anyone know if there are routines to determine difference-differential >equations or as also called delay-differential equations? are there also >algorithms available for the system identification...

IIR Filter Funktion with DSP5416
Hello I can produce with mathlab the coefficients for IIR Filter Bandpassfilter. I can export it as h-file. So I get real64_T NUM[MWSPT][3] and real64_T DEN[MWSPT_NSEC][3] arrays my question is: with the function from DSPLIB iir32(DATA *x,LDATA *h,DATA *r,LDATA **dbuffer ...) should I filter the input. I can't understand what should I take as "h" and "dbuffer". Can I use the coef. from Mathlab, or it's something else? what is biquads? I haven't found this word in dictionary. I thank all of you for your help. johnbesel@web.de (Eugene) wrote: >Hello >...