interp2 Error The grid vectors are not strictly monotonic increasing.

1 visualizzazione (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 16 Ago 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 Commento
Max Livshits
Max Livshits il 17 Ago 2015
Tank You for your response and simplified explication Walter. I have adjusted the number of sig figs and everything works just fine.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by