how to interpolate nx2 (x,y) matrix include some NaNs with newton's interpolation.

1 view (last 30 days)
% data1 is loaded data, nx2 matrix
x1 = data1(:,1); % constant time interval, nx1 matrix
y1 = data1(:,2); % data about x, nx1 matrix
x1, y1 is like
x1 = [ 0 5 10 15 20 25 30 35 40 45. . . ]
y1 = [ 0 0 2 3 NaN 11 14 17 NaN 13 . . . ]
how can i interpolate data1 to idata1 with newton's interpolataion (or other interpolation without using interp1).
idata1 is nx2 matrix with all NaNs are replaced by interpolation result.

Accepted Answer

Ameer Hamza
Ameer Hamza on 23 Jun 2020
Since all points in x1 are equidistant, therefore, it is not really relevant in the interpolation. You can use fillmissing(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/fillmissing.html to replace the NaN values. It gives several different options to replace the missing values.

More Answers (0)

Categories

Find more on Interpolation in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!