Message Boards Message Boards

0
|
3270 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Interpolation error: The element mesh has insufficient quality...

Posted 2 years ago

I have some data in the form of {{X,Y},Z} that I want to interpolate for Z. (X takes the values from 0 to 40 and Y from 0 to 50000 and Z is from -10 to +10 and the data I have, have integer values of Z and I want to interpolate for obtaining real values of Z also.

The graph of the data is: enter image description here

The data is on the form:

dataori={{{4.00,49741.80},+10.0},{{4.65,49153.60},+10.0},{{5.28,48506.40},+10.0},{{5.93,47918.20},+10.0},................................{{0.1,52840.6},9},{{0.0,53348.9},10},{{0.1,53258.7},-10}};

For full data I provide the Mathematica notebook as an attachment.

Using Interpolation to interpolate them:

g = Interpolation[dataori, InterpolationOrder -> 1 ]

I get the nightmare: "There are duplicated abscissa points in....." I have checked the data and do not see any intersecting points at all. So I'm puzzled.

After applying:

dataorisorted = Union[dataori]

Interpolation still complains with the same message.

Only after I do:

dataoridelete = DeleteDuplicatesBy[dataorisorted, First]

It works fine and finally interpolates them, but who knows what data has been erased.

And the interpolation graph is not good. It has those wavy values for Z that there isn't such thing in the original data.

enter image description here

Trying to eliminate the wavy thing, I have manually interpolated for every integer Z from -10 to +10, so the data was this time in the form {X,Y} (so I interpolated a line each time), to then obtain multiple values for every Z for all X with a 0.1 step for X. E.g for Z=+3 I obtained:

{{0.0, 44096.8}, +3.0}, {{0.1, 43938.1}, +3.0}, {{0.2,43779.4}, +3.0}, {{0.3, 43620.6}, +3.0}, {{0.4,43461.9}, +3.0}, {{0.5, 43300.4}, +3.0}, {{0.6,43125.6}, +3.0}, {{0.7, 42950.8}, +3.0}, ....etc

But now Interpolation again does not work and gives the message "There are duplicated abscissa points in.....". I have checked the data and again no intersecting whatsoever.

After applying:

datasorted = Union[data]
datadelete = DeleteDuplicatesBy[datasorted, First]
f = Interpolation[datadelete, InterpolationOrder -> 1 ]

It gives:

Interpolation::femimq: The element mesh has insufficient quality of 0.`. A quality estimate below 0. may be caused by a wrong ordering of element incidents or self-intersecting elements.

Interpolation::fememtlq: The quality 0.` of the underlying mesh is too low. The quality needs to be larger than 0.`.

And I do not know what is wrong?!

The graph of the data is: enter image description here

And the graph of Mathematica for it, for e.g Z=0 and -1 and -2 and -3 is this: enter image description here

enter image description here

POSTED BY: anoldfriend
3 Replies
Posted 2 years ago

Crossposted here.

POSTED BY: Rohit Namjoshi

Myoldfriend,

interpolation on unstructured grids most likely leads to unsatisfactory results. My idea is first to rescale the whole diagram according to the maximum contour (+10), thus a complete rectangle can be filled with data:

data1 = Association@Map[Round@#[[1, 2]] -> #[[All, 1]] &, GatherBy[data, Last]];
assocIp = Interpolation /@ data1;
indx = Range[-10, 10];
Plot[Evaluate[assocIp[#][x]/assocIp[10][x] & /@ indx], {x, 0, 40}, PlotLabels -> indx, ImageSize -> 700]

enter image description here

This could be the basis for calculating a structured grid for final 2D-interpolation. And when you then undo the scaling you are done!

But basically you can see with this graphic that your data are not clean and why DeleteDuplicates does not really help. You probably should consider solving that problem first.

POSTED BY: Henrik Schachner
Posted 2 years ago

but who knows what data has been erased

The duplicates that are deleted are all for values of 8 and 9 which Henrik's plot clearly shows

data // GroupBy[First -> Last] // Select[Length[#] > 1 &]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract