function newmatrix=resampmatrix(matrix,newlen)
%----------------
%this function uses linear interpolation to change the number of rows in a
%matrix.
%Copyright, 2011, Andrés González
%----------------
[rows cols]=size(matrix);
newmatrix=[];
for i=1:cols
len=rows;
x=1:len;x=x';y=matrix(:,i);
xx=1:(len-1)/(newlen-1):len;
xx=xx';
yy=interp1(x,y,xx,'linear');
newmatrix=[newmatrix yy];
end
No comments:
Post a Comment