Giving error while interpolating data or changing time step of data

1 回表示 (過去 30 日間)
sam moor
sam moor 2016 年 11 月 14 日
コメント済み: sam moor 2016 年 11 月 14 日
I have a data attached as rd.txt file. In the file 1st column represent time data and all other columns are distance data. I want to change 1st column data with time step of 0.02 like 0.02, 0.04, 0.06.....60 sec instead of 0.001,0.002,...60.001 as in rd.txt data. I used interp1 function but it gives me error as Error using griddedInterpolant The grid vectors are not strictly monotonic increasing.
Error in interp1 (line 186) F = griddedInterpolant(X,V,method);
Could anybody face such problem and now how to solve the problem? your answer are highly appreciated. Thank you

採用された回答

Jan
Jan 2016 年 11 月 14 日
It depends on what you want to achieve. If the data are not sorted, use sort at first. If you have several values for the same point, you have to decide, what you want to do: Use their mean or perhaps fit a polynomial through all data points? There is no unique solution and you have to decide what matchs your problem best.
  1 件のコメント
sam moor
sam moor 2016 年 11 月 14 日
yeah, this is the problem I am having. Thanks Anyway, Is there any solution to extract data from my original data i.e rd.txt for a time 0.02,0.04,0.06....60 sec and corresponding distances. Your answer is highly appreciated. Thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by