A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

Hot answers tagged

5

The simplest reason is that all realizable filters need to be causal. A physically realizable filter can't predict the future. If it were to have any type of response BEFORE the input actually happens, it would need to know that the input will occur before it does. When we're analyzing a filter as a system, we usually consider the input to come in the ...


5

Y[n]=aX[n]+(1-a)Y[n-1] It's an autoregressive moving average-- an infinite impulse response filter. Start with the equation above, take the z transform, and that gives the frequency response. It has nothing to do with the noise model. Here's the freq response for alpha =0.9, the frequency axis is scaled from 0 to your Nyquist frequency (half your ...


3

Your first problem is not insufficient design, but insufficient specification. Please note that 'as much as possible' is not a specification! Rather than wondering whether any particular filter is sharp enough, and may introduce high frequency noises onto the results, it would be more constructive to specify how much attenuation is required at what ...


3

It's unlikely to be true. IIR filters use feed-back paths and recirculate a fraction of the output (ever-diminishing hopefully). Hence they have the name Infinite Impulse Response meaning that an impulse on the input would cause an output that continues to decay to infinite. FIR filter do not have feedback paths and hence the name Finite Impulse Response ...


3

David Kessner mentioned the >> 16 as not being reliable, which is true. I've been bitten by that before, so now I always have a static assert in my code which checks that >> operates as I expect it. He suggested an actual divide instead. But here's how to do a proper arithmetic >> 16 if it turns out that yours isn't. union { int16_t i16s[2]; ...


3

The rate of decay of the impulse response only depends on the distance of the poles of the transfer function to the imaginary axis in the \$s\$-plane, i.e. on the real part of the (generally complex) poles. Remember that for a causal and stable system all poles of the transfer function must be in the left half plane (i.e. the real parts of the poles must be ...


3

I haven't worked with IIR filters yet, but if you only need to calculate the given equation y[n] = y[n-1]*b1 + x[n] once per CPU cycle, you can use pipelining. In one cycle you do the multiplication and in one cycle you need to do the summation for each input sample. That means your FPGA must be able to do the multiplication in one cycle when clocked at ...


2

I won't tell you if it's correct but I'll show you what it should be: - Don't forget the minus signs on the "a" coefficients. It was taken from here. There is the form that uses \$Z^{-1}\$ - it would make the first formula in the picture this: - \$y[n] = \omega[n]\cdot(b_0 + b_1Z^{-1} + b_2Z^{-2})\$ and from inspection you should recognize the \$\omega[n]\...


2

You have defined your DC as varying at 0.000001Hz. Are you aware that this is 1000000s, or 1.9 years? If that's truly your intention, with a sampling rate of 64000Hz, you need to average 64,000,000,000 samples to get your 1 DC measurement! I imagine you don't really mean such a low DC rate, but assuming something in the low Hz region, I suggest instead that ...


2

(+1) for a nice question. It's basically a mathematical fact, that sharp edges in the frequency (or time) domain lead to ringing (/harmonics), in the time (/freq.) domain. Higher orders also seem to have a longer time delay. Bessel filters have a nice step* response in the time domain. *In practice it's easy to see the step response on your 'scope. I don'...


2

I haven’t looked too closely at your code, but there is an obvious issue with it. You are implementing your 6th order filter in a direct form, not as biquads (I.e., second order sections). Although sixth order is really pushing the limit of numeric representation in a computer (it might still work for some pole combinations but not for others), this ...


2

My bet would be numerical precision in the HPF or the probable brokenness that is serial_printf in an interrupt handler, I don't know the platform, but code that might block in an ISR? On a UNO the double type is really a 4 byte float, not the 8 byte one you might expect if coming from a PC or grown up processor, so you only have 24 bits of precision and a ...


2

I'm not following everything you're doing, but this piece of code looks suspicious: if cnt = 29 then --reset count if all done -- ... elsif cnt > 12 then sum_1 <= sum_1 + resu(cnt - 8); --calculate sum end if; This branch gets executed for cnt values from 13 through 28, generating ...


2

As you're looking for an intuitive way of doing it ... How 'boingy' does the response look? If the response to an impulse was another impulse, the filter would simply be reproducing the input, with a flat frequency response. But like a bell, this filter 'rings' when hit with an impulse. If it rang for a very long time, the ring frequency would be well-...


2

How can I approach this problem? Here's a useful identity: \$sin(x)cos(y)=​\frac{1}{2}(sin(x+y)+sin(x−y))\$ \$ \begin{align} \end{align} \$ \$ \begin{align} h(n) &= sin(\pi\frac{1}{100}n)cos(2\pi\frac{12}{100}n) \\\\ & =\frac{1}{2}(sin(\pi\frac{1}{100}n+2\pi\frac{12}{100}n)+sin(\pi\frac{1}{100}n-2\pi\frac{12}{100}n))\\\\ & =\frac{1}{2}(sin(\...


1

The question is how did you do the shift to fixed point. The main key here is that you're trying to preserve all the dynamic range. If all your filter constants are between 0 and 5, let's say, if you use 64bit you will have very little dynamic range because it is impossible to do 1.3, you can just do integers. What is typically done, for example, is to use ...


1

Try grpdelay(b,a,1e6) This will plot the group delay of the filter at various frequencies and I get about around 240 to 350 samples for 'low' frequencies. Yes, 32 bit should be sufficient.


1

For example if you execute a PID at 0.2Hz then you can control a system with a dynamics max. 0.1Hz according to Shannon. Now if you process 16 taps FIR every 100ms you get a delay of 8 cycles which would be 800ms, which is not so bad, but maybe too much for PID executing every 5000ms. But if you run FIR at 10ms, you get only 80ms delay, or you can run every ...


1

It is possible with an IIR filter, but not accurately with a plain Butterworth filter. As far as I can recall, the only IIR filter with flat group delay is the Bessel, whose stopband attenuation is inferior to the Butterworth. The problem with the Butterworth is that the group delay is a function of frequency, therefore the different frequency components of ...


1

If one has a "quadratic" equation of the form Ax²+Bx+C, and the A term is zero, the resulting curve will look like a straight line--because it will be a straight line. On the other hand, equations of that form where A is zero are generally termed "linear equations" with the A term omitted. Likewise, it is possible to express a general form of linear ...


1

I have tried to implement scripts for authomatic implementation of IIR filters, where you can defined whether the design should be as fast as possible (so each multiplication is performed with dedicated multiplier) or as small as possible (so each multiplier is reused). The sources have been published on alt.sources as "Behavioral but synthesizable ...


Only top voted, non community-wiki answers of a minimum length are eligible