Forums

Multirate filter

Started by Marco Trapanese July 2, 2009
Hello,

I have two signals, one sampled at 20 Hz and the other at 8 Hz.
The filter I want to use is:

out[n] = (1 - a) * (out[n-1] + in1[n]) + a * in2[n];

where:
in1 @ 20 Hz
in2 @ 8 Hz

the math is done @ 20 Hz.

How should I take care of the different sampling rate?

Thanks
Marco
A straightforward way is to interpolate in2 with a 5/2 sample rate
converter if it is possible in your application. 

--
Alexander 

Alexander Sotnikov ha scritto:

> A straightforward way is to interpolate in2 with a 5/2 sample rate > converter if it is possible in your application.
Ok, it should be better than use the constant value as I'm doing now. Thanks Marco
Marco Trapanese wrote:
> Alexander Sotnikov ha scritto: > >> A straightforward way is to interpolate in2 with a 5/2 sample rate >> converter if it is possible in your application. > > > Ok, it should be better than use the constant value as I'm doing now.
The signals must be separate to have been sampled separately. Why not filter them separately? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
On Thu, 02 Jul 2009 10:53:09 +0200, Marco Trapanese wrote:

> Hello, > > I have two signals, one sampled at 20 Hz and the other at 8 Hz. The > filter I want to use is: > > out[n] = (1 - a) * (out[n-1] + in1[n]) + a * in2[n]; > > where: > in1 @ 20 Hz > in2 @ 8 Hz > > the math is done @ 20 Hz. > > How should I take care of the different sampling rate?
You could use some sort of polyphase filtering on in2 (the suggested interpolation is one simple form). But the better the filtering looks in the frequency domain the more delay you'll have in the time domain. This may not matter one whit, but if it's in a control loop it could be deadly. I can't think of an instance where, a control loop, I'd use anything but the latest value of in2. -- http://www.wescottdesign.com
Tim Wescott ha scritto:

> I can't think of an instance where, a control loop, I'd use anything but > the latest value of in2.
Hi Tim, I'm not sure I understand correctly your last sentence due to my poor English. Are you saying you wouldn't use the rate converter filter at all? Hence, the in2 goes straight into the loop control I think you said this but I'm not sure, sorry. Marco
On Thu, 02 Jul 2009 16:31:29 +0200, Marco Trapanese wrote:

> Tim Wescott ha scritto: > >> I can't think of an instance where, a control loop, I'd use anything >> but the latest value of in2. > > > Hi Tim, > > I'm not sure I understand correctly your last sentence due to my poor > English. Are you saying you wouldn't use the rate converter filter at > all? Hence, the in2 goes straight into the loop control > > I think you said this but I'm not sure, sorry.
If delay were a paramount consideration (which it often is in a control loop), yes. If both delay and something like DC balance were important I may separate the signal into an immediate part (say for a proportional step) and a slow part (say for an integrator), leave the former alone and do multirate filtering on the latter. So I guess I _can_ think of a time when I'd use multirate filtering in a control loop... -- www.wescottdesign.com