How to use interp1 with data neither in increasing order nor decreasing order.
8 views (last 30 days)
Show older comments
I have two data sets. One is in increasing order while its corresponding value is in random order (neither increasing nor decreasing only). I know interp1 can be used only for increasing data sets. Let me know how can i use it for this particular case.
Please reply at the earliest. Thanks!
0 Comments
Answers (2)
Star Strider
on 4 Jun 2016
The interpolation functions such as interp1 require only that the independent variable be monotonically non-decreasing. The dependent variable can do anything it wants to.
0 Comments
Azzi Abdelmalek
on 4 Jun 2016
Edited: Azzi Abdelmalek
on 4 Jun 2016
x=0:2:10 % is sorted
y=rand(size(x)) % y is not sorted
xi=[1 3 5]
yi=interp1(x,y,xi)
If this is what you've asked, this example shows it works
0 Comments
See Also
Categories
Find more on Shifting and Sorting Matrices 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!