Does the resample function do sinc interpolation before resampling?
4 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
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
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)
% Plot results
plot(t,x,'o-',tShift,xShift,'*')
% Zoom in
plot(t,x,'o-',tShift,xShift,'*')
xlim([0.335,0.345])
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!