interpolate data in timeseries

S
Spiliopoulos · Dec 8, 2021 · 2K views
Question
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?
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 13, 2026
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')
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.
 
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!