DSPRelated.com
Forums

Resampling one signal to match another

Started by Randy Yates July 19, 2013
I have two digital signals, x1[n] at approximately 370 samples/sec, and
x2[n] at approximately 400 samples/sec.

How can I resample x1[n] so that it matches x2[n] without knowing the
precise sample rate of either?
-- 
Randy Yates
Digital Signal Labs
http://www.digitalsignallabs.com
On 7/19/2013 6:41 AM, Randy Yates wrote:
> I have two digital signals, x1[n] at approximately 370 samples/sec, and > x2[n] at approximately 400 samples/sec. > > How can I resample x1[n] so that it matches x2[n] without knowing the > precise sample rate of either? >
If signals are correlated, sliding correlation peak gives you running difference in time. Vladimir Vassilevsky DSP and Mixed Signal Designs www.abvolt.com
Vladimir Vassilevsky <nospam@nowhere.com> writes:

> On 7/19/2013 6:41 AM, Randy Yates wrote: >> I have two digital signals, x1[n] at approximately 370 samples/sec, and >> x2[n] at approximately 400 samples/sec. >> >> How can I resample x1[n] so that it matches x2[n] without knowing the >> precise sample rate of either? >> > If signals are correlated, sliding correlation peak gives you running > difference in time.
Vlad, Thanks for taking a stab. No, I didn't mean to imply a correlation operation - x1[n] and x2[n] are totally different signals. I should have been more clear. When I said "so that it matches" I meant so that the sample rate of x1[n] matches the sample rate of x2[n]. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
On Fri, 19 Jul 2013 07:41:02 -0400, Randy Yates
<yates@digitalsignallabs.com> wrote:

>I have two digital signals, x1[n] at approximately 370 samples/sec, and >x2[n] at approximately 400 samples/sec. > >How can I resample x1[n] so that it matches x2[n] without knowing the >precise sample rate of either?
Hi Randy, That's an interesting question. Are your two digital signals sampled sequences of the same analog signal obtained using two different sample rates? [-Rick-]
Rick Lyons <R.Lyons@_BOGUS_ieee.org> writes:

> On Fri, 19 Jul 2013 07:41:02 -0400, Randy Yates > <yates@digitalsignallabs.com> wrote: > >>I have two digital signals, x1[n] at approximately 370 samples/sec, and >>x2[n] at approximately 400 samples/sec. >> >>How can I resample x1[n] so that it matches x2[n] without knowing the >>precise sample rate of either? > > Hi Randy, > That's an interesting question. Are your two > digital signals sampled sequences of the same > analog signal obtained using two different > sample rates?
Hi Rick, No. They are from an LSM330 chip - one signal is the acceleration at ~400 Hz, the other is the gyro data at ~370 Hz. -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Doh! Ok, I can't read. 

The signal I've been saying is 370 Hz is actually 380 Hz. 

It doesn't really change the question, but FYI.

--Randy

Randy Yates <yates@digitalsignallabs.com> writes:

> Rick Lyons <R.Lyons@_BOGUS_ieee.org> writes: > >> On Fri, 19 Jul 2013 07:41:02 -0400, Randy Yates >> <yates@digitalsignallabs.com> wrote: >> >>>I have two digital signals, x1[n] at approximately 370 samples/sec, and >>>x2[n] at approximately 400 samples/sec. >>> >>>How can I resample x1[n] so that it matches x2[n] without knowing the >>>precise sample rate of either? >> >> Hi Randy, >> That's an interesting question. Are your two >> digital signals sampled sequences of the same >> analog signal obtained using two different >> sample rates? > > Hi Rick, > > No. They are from an LSM330 chip - one signal is the > acceleration at ~400 Hz, the other is the gyro data at > ~370 Hz.
-- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
>I have two digital signals, x1[n] at approximately 370 samples/sec, and >x2[n] at approximately 400 samples/sec. > >How can I resample x1[n] so that it matches x2[n] without knowing the >precise sample rate of either? >-- >Randy Yates >Digital Signal Labs >http://www.digitalsignallabs.com >
fractional rate filtering? _____________________________ Posted through www.DSPRelated.com
On 7/19/13 9:10 AM, Randy Yates wrote:
> Vladimir Vassilevsky<nospam@nowhere.com> writes: > >> On 7/19/2013 6:41 AM, Randy Yates wrote: >>> I have two digital signals, x1[n] at approximately 380 samples/sec, and >>> x2[n] at approximately 400 samples/sec. >>> >>> How can I resample x1[n] so that it matches x2[n] without knowing the >>> precise sample rate of either? >>> >> If signals are correlated, sliding correlation peak gives you running >> difference in time. > > Vlad, > > Thanks for taking a stab. > > No, I didn't mean to imply a correlation operation - x1[n] and x2[n] > are totally different signals. I should have been more clear. When > I said "so that it matches" I meant so that the sample rate of x1[n] > matches the sample rate of x2[n].
if there is no natural correlation (given a common time base) between x1[n] and x2[n], i don't see how you could hope to know how much to stretch x1 (or to scrunch x2) to match the other's sample rate precisely. so you have two fully uncorrelated signals, sampled independently at rates that you know are different, but you don't have a solid handle on either the two relative rates nor the phase offset of the sampling signal? if that is the case, how is that problem different from me asking "i got this signal here that i sampled yesterday around 1 pm EDT at 400 Hz and you got this other signal over there that you sampled yesterday at around 1 pm EDT at 380 Hz, how do we line the two totally independent signals up?" sounds like a female canine to me. (sorry to be so sanguine about it, Randy.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
On 7/19/2013 11:28 AM, Randy Yates wrote:
> Rick Lyons <R.Lyons@_BOGUS_ieee.org> writes: > >> On Fri, 19 Jul 2013 07:41:02 -0400, Randy Yates >> <yates@digitalsignallabs.com> wrote: >> >>> I have two digital signals, x1[n] at approximately 370 samples/sec, and >>> x2[n] at approximately 400 samples/sec. >>> >>> How can I resample x1[n] so that it matches x2[n] without knowing the >>> precise sample rate of either? >> > No. They are from an LSM330 chip - one signal is the > acceleration at ~400 Hz, the other is the gyro data at > ~370 Hz.
Then it is trivial problem of combining asynchronous sensors. Take one signal as master, interpolate other signals to it. BTW, accelerometer and gyro signals are indeed correlated. VLV
On Fri, 19 Jul 2013 07:41:02 -0400, Randy Yates wrote:

> I have two digital signals, x1[n] at approximately 370 samples/sec, and > x2[n] at approximately 400 samples/sec. > > How can I resample x1[n] so that it matches x2[n] without knowing the > precise sample rate of either?
As stated, you lack enough information to do this job. Are x1 and x2 sampled-time versions of the same time-domain signal, or are they otherwise correlated? Or do you have some other side information that you're not telling us about that would let you deduce the timing relationship? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com