n=10; x=1:n; y=rand(1,n); % Original vector (­ì©l¦V¶q) ratio=1.75; % The vector interpolation should have a length equal to 1.8 times the original vector m=round(n*ratio); % Length of the scaled vector x2=linspace(1, n, m); y2=interp1(x, y, x2); % Vector after interpolation subplot(2,1,1), plot(x, y, 'o-', x2, y2, 'o:'); legend('Original vector', 'Interpolated vector', 'location', 'northOutside', 'orientation', 'horizontal'); subplot(2,1,2), plot(1:length(y), y, 'o-', 1:length(y2), y2, 'o:'); legend('Original vector', 'Scaled vector', 'location', 'northOutside', 'orientation', 'horizontal'); fprintf('Desired length ratio = %f\n', ratio); fprintf('Actual length ratio = %f\n', length(y2)/length(y));