Can interp1 function be used when the time interval of data isn't uniform?
Show older comments
In the interp1 function, yi = interp1(x,Y,xi,method), I have x as time vector with non-uniform interval. But the length of x and Y vectors are same. Can I use the interp1 function to interpolate the data?
Accepted Answer
More Answers (1)
Matt Fig
on 20 Aug 2012
When I have a question like this, I just do a little experiment.
x = sort(rand(1,30)*2*pi); % Non-uniform data
y = sin(x); % Underlying function
xi = 0:.25:2*pi; % Interpolation points
yi = interp1(x,y,xi,'spline');
plot(x,y,'*r',xi,yi,'b')
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!