produces

"Choose your poison" as far as what interpolant you actually want.
If you have Signal Processing TB, there's also resample you could play with.
Hi all, I have a timeseries vector lets say with 7 points : v=[0.18 3.15 0.18 0.16 0.17 0.58 0.33 ]; I would like to create a new vector by interpolating data so I have extra 3 points among two values: somethng like: v_new=[0.18 ... ... ... 3.15 ... ... 0.18... and so on ] could you help me with that?
Prashant Kumar answered .
2025-11-20
v=[0.18 3.15 0.18 0.16 0.17 0.58 0.33 ]; % example data % the engine nI=3; % number points to insert N=numel(v); % initial vector size NN=(N-1)*nI+N; % new N for augmented v xv=linspace(1,N,NN); % uniform spacing along 1:N NN points vv=interp1(1:N,v,xv); % linear interpolation vvv=interp1(1:N,v,xv,'pchip'); % or pchip interpolation
Illustrate results...
plot(v,'o-')
hold on
plot(xv,vv,'x')
plot(xv,vvv,'d-')
legend('Original','Linear','PChip')
