# Downsampling from 100Hz to 60 Hz

I have two sensors measuring a single time varying signal . The first sensor (reference sensor) is sampling the data at 60 Hz and the second sensor (test sensor) is sampling the data at 60 Hz. I need to check the accuracy of the test sensor by comparing with the reference sensor. I am confused about how to downsample the data recorded at 100 Hz to 60 Hz. I see it is quite trivial to downsample from 100 Hz to 50Hz/25 Hz. But I am confused how to downsize to 60 Hz.

After downsampling, is cross-correlation a good technique to compare the data from two sensors?

Can you please help?

Thanks, Peter

• Downsampling by an integer factor might seem evident, but it is not trivial and requires care, as much as downsampling to another frequency. Wouldn't your consider upsampling both to, say, 300 Hz? And what is you criterion to tell a signal is good? – Laurent Duval May 20 '18 at 20:55
• @Andrea you've got a small math problem: as Laurent said, you want to oversample threefold to 300 Hz and then downsample 5× to 60 Hz (you got the factors the wrong way around) – Marcus Müller Jun 20 '18 at 13:29
• I don't quite understand the problem: Do both sensors actually have the same sampling rate of $60\,\text{Hz}$? – applesoup Jun 20 '18 at 13:31
• I assume he must mean one sensor is sampling at 100Hz. If so as Marcus alluded upsampling the 100 MHz with a x3 interpolator and then decimating by 5 to get that signal at 60 Hz makes sense. Nothing needs to be done to the signal already at 60Hz. Assuming the reference sensor is “known good” then yes correlation of the two once at the same rate make perfect sense. Specifically computing the correlation coefficient would give a quality metric of the result. If both sensors have unknown quality, correlation will not provide useful information. – Dan Boschen Sep 22 '18 at 18:04

## 3 Answers

Are the samples adhering to Nyquist (properly pre filtered)?

If so, I would just resample to one common rate, prefereable >= max(rate1, rate2). And align them in time. Check out MATLABs resample() function.

If the samples are not adhering to Nyquist, then you need to think about what they represent, how they are sampled and in what respect you need to compare them.

First fix your question: it talks about both sensors sampling at 100Hz. Then the question is what the statistics for the change rates of your measured signals are in order to decide what the respective sensors may be missing and what they might be aliasing in their measurement. Any form of resampling will only lead to comparable results if the processed sensor data can be made to actually unambigously represent the same information. This is feasible when the sensor signals are low-pass filtered before sampling so that no aliasing is involved any more.

Cross-correlation is not an overly useful technique for "comparing the data from two sensors". It will tell you whether both sensors are actually working at all and whether the latencies of the measurement for both sensors differ (assuming sufficient change in the measured signal).

The naive idea comes up to me is to throw away 40Hz in a signal series, however, the remaining 60Hz maybe not in the right phase. So you may want to use FFT to shift the signal to the phase you want. For any real number x0, if h(x) = f (x − x0), then ĥ(ξ) = e−2πix0ξ f̂ (ξ).

Actually, you can also shift the 40Hz part. By doing this, some part of the 60Hz will be averaged and be smoother.

• Can you explain in detail what you mean by throwing away 40Hz in a signal series? When sampling at 100Hz, the baseband frequencies will range only from -50Hz to +50Hz, I am not able to grasp your idea of throwing away 40Hz in this. – DSP Rookie Apr 14 '20 at 11:30