interp2 Error The grid vectors are not strictly monotonic increasing.

2 views (last 30 days)
I am looking for some help where i can first understand why some of my data works with this script and some does not. And second i need to figure out how to fix the data that does not work.
In my script i am trying to generate a 2D image that has the proper time variable on the left side. My instrument creates a materix that is made by time slice and not a linear time scale. The interp2 function can correct this and create the images that i need.
The error that i am getting in matlab is that The grid vectors are not strictly monotonic increasing. This error means that the program is unable to compute the proper point where new points go because the squares on the grid are not constant. I dont know how to fix this so any help would be appreciated.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Aug 2015
>> find(diff(y)==0)
ans =
520 522 524 526 528 710 712 714 716 718 720 722 724 726 728
You have some duplicate y. The first of these, location 520, occurs where y goes from being a two-digit positive number to being a 3-digit positive number. Before that locations you have points that are as close together as 0.02 apart, and in the area just before location 520 the points are about 0.5 apart . But your representation of y is in scientific notation with exactly 3 digits besides the sign and exponent. Unless the points just happen to get further apart just as y goes to 100, you do not have sufficient precision in your representation of y and so y that were originally distinct are getting rounded to be the same integer in your file representation of them.
You need to go back and recreate your csv using more significant digits in your representation of y.
  1 Comment
Max Livshits
Max Livshits on 17 Aug 2015
Tank You for your response and simplified explication Walter. I have adjusted the number of sig figs and everything works just fine.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB 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!