The actual data is some form of processed signals. For the nearest, linear, and v5cubic methods, interp1(x,Y,xi,method) returns NaN for any element of xi that is outside the interval spanned by x. I would like interpn to return a NaN value in that case. Therefore, in some dimensions, there are less than 2 datapoints which prevents matlab from interpolating. The problem is that the data contains NaN's. NaN NaN 0.42639 -0.37281 -0.23645 2.0237 -2.2584 2.2294īased on the responses, I think there's been a confusion: obviously I'm not working with random data, the code shown above is simply an example of how the data is structured. MATLAB: Using interpolation to replace missing values (NaN) I would like to interpolate data in multiple dimensions using the interpn command. ![]() I would like to replace all NaNs using some sort of interpolation method, how can I can do this in MATLAB? I am also open to other suggestions on how to deal with these missing values.Ĭonsider this sample data to illustrate the problem: seq = The sequences contain some missing values represented by NaN. interpn works for all N-D arrays with 2 or more dimensions. with both row and column vectors) are passed through ndgrid to create the Y1, Y2, Y3, etc. Vector arguments that are not the same size, and have mixed orientations (i.e. must be arrays of the same size, or vectors. ![]() Learn more about interpolate, missing values I have Matlab 2013, and I want to apply spline interpolation in my data matrix with NaN values. ![]() I have cell array each containing a sequence of values as a row vector. Out of range values are returned as NaNs. Fill missing NaN values with Interpolation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |