MATLAB: Resampling Data using Interp1

data processingdownsampleinterp1interpolationresampleresamplingsamplingtime series

Hello!
This may be a fairly obvious answer, but I'm trying to resample some data down to 100 Hz using interp1. I load my data, and then extract the first column (which is the time series) to use in my for loop. However, I get the error "Interpolation requires at least two sample points in each dimension." I tried adjusting the code to call for a(i+1) to see if maybe I needed to start later, but I got the same error. The data itself is part of my thesis so I'm not sure if I can attach it, but I've copy and pasted my code below.
Thank you in advance for any help!
load('BNI_processed.mat')
a = Force_arr;
time_matrix =(a(1:end,1)).';
for i = 1:length(time_matrix)-2
aa = length(time_matrix(i):time_matrix(i+1));
p = 61;
Force(:,i)=interp1(a(i,2),1:aa/p:aa, 'spline');
end

Best Answer

You are doing signal processing. For that, use the resample function. It will do the interpolation, and will also use an anti-aliasing filter to remove unwanted artifacts. I am not certain what your signal is or what you want to do with it, so I cannot provide a link to the most appropriate section of the resample documentation for that.