MATLAB: Resize a matrix (1×30) to (1×25)

size;

Hi: I have (g) a matrix with size (1×30) and wanted to resize it to (1×25), how can I do this? I think I should keep the min and max numbers in order not to destroy the data and somehow average the numbers in middle to get red of 5 numbers. Can someone here assist me with this? thanks

Best Answer

Hi,
you could use interp1
g = rand(1,30);
newx = linspace(1,30,25);
newg = interp1(g,newx);
plot(g,'b-+');
hold on;
plot(newx,newg,'ro');
Related Question