So I have this function that I modified slightly that takes in a "main" vector and a "base" vector and stretches/compresses the main vector to the dimensions of the base vector.
function output = stretch(main, base)
N=length(main)-1;
X=0:N;
XI=0:(length(main)/length(base)):N;
output=interp1(X,main,XI);
end
The base vector always has a length of 1620 so that is the goal. This works most of the time, but for some "main" vector dimensions, the vector of the stretched/compressed vector is 1619 or 1618. I have no idea how to apply a correction for this - any thoughts?