Does the resample function do sinc interpolation before resampling?

11 views (last 30 days)
I have original samples x of x(t) taken at t=kT_s where k is integer and T_s is the sampling period. From these samples, I want to find the samples of the x(t) at time instants t=kT_s+delta. My initial instinct is to reconstruc x(t) from the original samples using the sinc interpolation, and use the resample function at the new time instants. However, I'm not sure if I provided the resample function with the original samples and the new sampling times, it would do the interpolation under the hood.

Answers (1)

Jon
Jon on 11 Jul 2023
Edited: Jon on 11 Jul 2023
It sounds like you are not resampling at a new frequency (the main purpose of resample) but instead creating samples of a delayed version of your original sequence. Since delaying in the time domain is equivalent to phase shifting in the frequency domain, you can transform your signal to the frequency domain, phase shift it and then transform it back to the time domain.
I haven't tested this code, but it looks like the approach is illustrated by @Prabhan Purwar's contribution: https://www.mathworks.com/matlabcentral/answers/483938-time-shifting-an-audio-in-a-frequency-domain?s_tid=mwa_osa_a
  1 Comment
Jon
Jon on 11 Jul 2023
If your sample rate is relatively high, so, very small changes between your sample points, you could also approximate obtaining the phase shifted samples simply by using interpolation in the time domain, for example:
% Example waveform
T = 0.001;
t = 0:T:1;
x = sin(t*2*pi)+cos(0.5*t*2*pi+pi/3);
% Delayed samples
delta = 0.0123;
tShift = t+delta;
xShift = interp1(t,x,tShift)
xShift = 1×1001
0.5434 0.5469 0.5503 0.5538 0.5573 0.5607 0.5641 0.5676 0.5710 0.5744 0.5778 0.5812 0.5846 0.5880 0.5913 0.5947 0.5980 0.6013 0.6047 0.6080 0.6113 0.6145 0.6178 0.6211 0.6243 0.6275 0.6308 0.6340 0.6372 0.6403
% Plot results
plot(t,x,'o-',tShift,xShift,'*')
% Zoom in
plot(t,x,'o-',tShift,xShift,'*')
xlim([0.335,0.345])

Sign in to comment.

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!