Unfortunately the sensor is a black box and I have to take the measurement values I get via serial port. So there is no chance for modifications. The only part I can play with is the digital representation of the data.
signal with high- and low-frequency components, real-time application
Started by ●May 7, 2008
Reply by ●May 8, 20082008-05-08
Reply by ●May 8, 20082008-05-08
On May 7, 9:21 pm, stefan_bai...@yahoo.com wrote:> Jason, > > not *HARD* real-time, maybe two to three secs delay are tolerable. But > this is not enough for a standard high-pass filter:-(Well, it sounds like you're pretty order-limited on your filter then. As Tim suggested, I would look into using an IIR filter instead. You can get a lot more "bang for your buck" as far as meeting filter specs with lower orders, but you have to deal with more numerical precision and phase distortion issues. The implementation isn't that much harder than an FIR filter, though. Jason
Reply by ●May 8, 20082008-05-08
On Wed, 07 May 2008 18:01:56 -0700, stefan_baierl wrote: (start restored context -- this is USENET)> stefan_baierl@yahoo.com wrote: >> Hi all, >> >> I have a signal that consists of components with higher an lower >> frequencies. >> For my application I try to keep the higher frequencies and remove the >> lower ones. Normally I could achieve this with a high-pass filter, but >> in my case, the result is not promising. >> >> Problem is, that I need the result in real-time, so for a newly read >> sensor value I have to obtain the *LAST* filtered value without any >> delay. A high-pass filter (or any filters I'm aware of), has it's >> weaknesses on the borders of the signal (so the first and last values >> of the signal are destorted through missing values before and after >> first/last values) or it has some kind of delay. >> >> My question: Is there a better algorithm to get appropriate results for >> a newly measured sample? Sampling rate is 1 Hz and I can't wait 20 >> seconds till I have a stable (high-pass filtered) value. >> >> Thanx for any hints! >> > So you're sampling intermittently? Why can't you sample continuously? > Are you using an IIR filter?(end restored context)> Hi Tim, > > seems, that I wasn't precise enough. The signal, I'm sampling, is > provided once per second from an external device. So I'm not reading > from an ADC and therefore have no chance to get a higher update rate. > > Currently I use a FIR filter (since I have a C++ implementation for it).I wasn't asking about sampling rate, I was asking if you were sampling continuously or intermittently, i.e. are you sampling once per second always, or are there times when you stop sampling, then start up again. I assume the answer is 'no'. An IIR filter will have tremendously less delay than an FIR. For just about anything that needs to be low delay it'll be superior. A first- order DC blocking filter is dead simple to implement, and (depending heavily on your application) may be all you need. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
Reply by ●May 8, 20082008-05-08
On 8 Mai, 02:38, stefan_bai...@yahoo.com wrote:> First of all, thanks for your ideas and comments! > > @Jerry > I have to *KEEP* the "high" frequencies, in my case these are about > 0.1 Hz, so Nyquist is fulfilled. The part of the signal that has to be > removed is about 0.05 Hz and lower.I've had a look at the data you posted. I can't see any big problems with applying a high-pass filter to them, once one accepts a latency in the output from the filter. I do notice, however, that the frequency response is approximately flat around Fs/2. Is there an ADC involved in this system? If so, is the anti-alias filter OK? Rune
Reply by ●May 8, 20082008-05-08
Tim Wescott wrote:> An IIR filter will have tremendously less delay than an FIR.Not at all. FIR does not have to be linear phase.> For just > about anything that needs to be low delay it'll be superior.Bla-bla-bla. Anything, low, superior and other adjectives. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●May 8, 20082008-05-08
Dnia 08-05-2008 o 02:38:52 <stefan_baierl@yahoo.com> napisa�(a):> First of all, thanks for your ideas and comments! > > @Jerry > I have to *KEEP* the "high" frequencies, in my case these are about > 0.1 Hz, so Nyquist is fulfilled. The part of the signal that has to be > removed is about 0.05 Hz and lower. > > @Vladimir > @Clay > Yes, prediction also came to my mind. The trouble is, I don't have an > idea how to accomplish this task. > > I have uploaded a small file containing a typical portion of my signal > to http://www.freewebs.com/stefanbaierl/sig1.txt > Maybe someone of you has time to look at it...I have looked at the data. I found it is square wave (T=480s, sig. lvl. ca. 0 to -3) plus "some sort of" noise (std = 0.002, mean=0, almost flat FFT for all freq.) (LP and HP IIR ord. 54, fc=0.06). Why do you need to preserve noise? -- Mikolaj
Reply by ●May 8, 20082008-05-08
> Tim Wescott wrote: > >> An IIR filter will have tremendously less delay than an FIR. > > Not at all. FIR does not have to be linear phase. > >> For just about anything that needs to be low delay it'll be superior.> Bla-bla-bla. Anything, low, superior and other adjectives.- I can think of a couple of adjectives for that comment. ; )
Reply by ●May 8, 20082008-05-08
On 8 Mai, 10:34, Mikolaj <sterowanie_komputer...@hahapoczta.onet.pl> wrote:> Dnia 08-05-2008 o 02:38:52 <stefan_bai...@yahoo.com> napisa�(a): > > > First of all, thanks for your ideas and comments! > > > @Jerry > > I have to *KEEP* the "high" frequencies, in my case these are about > > 0.1 Hz, so Nyquist is fulfilled. The part of the signal that has to be > > removed is about 0.05 Hz and lower. > > > @Vladimir > > @Clay > > Yes, prediction also came to my mind. The trouble is, I don't have an > > idea how to accomplish this task. > > > I have uploaded a small file containing a typical portion of my signal > > tohttp://www.freewebs.com/stefanbaierl/sig1.txt > > Maybe someone of you has time to look at it... > > I have looked at the data. I found it is square wave (T=480s, sig. lvl. � > ca. 0 to -3) > plus "some sort of" noise (std = 0.002, mean=0, almost flat FFT for all � > freq.) (LP and HP IIR ord. 54, fc=0.06). > Why do you need to preserve noise? > > -- > Mikolaj@Tim I'm sampling continuously. As far as I understand it, a DC blocking filter wouldn't be the answer, since there is some kind of low frequency (but not steady as DC) on it. @Vladimir What is now the answer? FIR or IIR? I thought the implementation and results are different - as some other posters told. @Mikolaj The uploaded signal was just an example, so another sequence could look different with other underlying signal components on it. But anyway, thanks for your analysis! "Noise" in my situation is the part of the signal I need, the superimposed lower frequencies are due to disturbance - I know, normally it's the other way round;-)
Reply by ●May 8, 20082008-05-08
stefan_baierl@yahoo.com wrote:>[snip]> The uploaded signal was just an example, so another sequence could > look different with other underlying signal components on it. But > anyway, thanks for your analysis! > "Noise" in my situation is the part of the signal I need, the > superimposed lower frequencies are due to disturbance - I know, > normally it's the other way round;-)Not so abnormal as you may think. Consider standard analog T.V. The video signal is in MHz region. Horizontal sync, 50 to 60 Hz. Which is "signal"? Depends on where in system you are.
Reply by ●May 10, 20082008-05-10
Hi Stefan, I think your question may be more basic than the other posts have assumed. I understand that your problem involves receiving one sample each second, and I have looked at the data you provided. Say you are at some instant of time, t, and have just received a sample. Of course, you have also received previous samples, at time t-1, t-2, t-3, and so on. I think you have the impression that a filter cannot give you an output at time t, that represents what is happening in the signal at time t. This is not correct. For example, consider taking the sample at time t, and subtracting the average of the last 20 or so samples. This is an FIR high-pass filter that only uses past values of the signal. This is the first algorithm that you should try (it is even optimal for many problems of this type). Experiment by adjusting the number of samples in the average. If you want better performance, try weighting the average so that more recent samples are given more importance. Alternatively, try the simple "single pole" IIR filter described below. This is the digital equivalent of an analog RC filter. Good luck! Regards, Steve http://www.dspguide.com/ch14.htm http://www.dspguide.com/ch15.htm http://www.dspguide.com/ch19/2.htm that 'm not sure that the answers you have receive really address your question. So let me give it is ahow you have>






