Interpolation of data
Clash Royale CLAN TAG#URR8PPP
up vote
4
down vote
favorite
Consider a set of data points
data = 1.76842, -4.05181, 1.78353, -4.08368, 1.7926, -4.10526,
1.83347, -4.19819, 1.83984, -4.21376, 1.87722, -4.31579,
1.8896, -4.35321, 1.91579, -4.44367, 1.93133, -4.50411,
1.93709, -4.52632, 1.95047, -4.57586, 1.97969, -4.64556,
2.0356, -4.73684, 2.04833, -4.75802, 2.06316, -4.78248,
2.11756, -4.86965, 2.16706, -4.94737, 2.18808, -4.97944,
2.21053, -5.01398, 2.25946, -5.08799, 2.30551, -5.15789,
2.33156, -5.19552, 2.35789, -5.23314, 2.40539, -5.30058,
2.45345, -5.36842, 2.47936, -5.40543, 2.50526, -5.43997,
2.55506, -5.50781, 2.60946, -5.57895, 2.6322, -5.60814,
2.65263, -5.63466, 2.70962, -5.70806, 2.77582, -5.78947,
2.78877, -5.80551, 2.8, -5.81898, 2.8685, -5.90214, 2.92031,
-5.96135, 2.94737, -5.9926, 2.95435, -6., 3.03285, -6.0884,
3.09474, -6.15707, 3.11604, -6.1801, 3.14424, -6.21053,
3.20008, -6.27056, 3.24211, -6.31538, 3.28413, -6.36102,
3.34169, -6.42105, 3.36933, -6.44984, 3.38947, -6.47122,
3.45452, -6.53865, 3.51554, -6.60115, 3.53684, -6.62294,
3.54037, -6.62654, 3.5449, -6.63158, 3.61053, -6.6986,
3.62607, -6.71464, 3.64794, -6.73684, 3.68421, -6.77385,
3.71213, -6.80222, 3.75113, -6.84211, 3.79762, -6.89062,
3.83158, -6.92516, 3.88353, -6.97841, 3.95477, -7.05263,
3.96866, -7.06733, 3.97895, -7.07854, 4.0509, -7.15543,
4.05278, -7.15769, 4.12632, -7.23931, 4.14733, -7.26316,
4.21626, -7.34519, 4.27368, -7.4192, 4.29268, -7.44655,
4.31168, -7.47368, 4.36291, -7.55674, 4.41472, -7.67516,
4.4176, -7.68421, 4.41817, -7.68832, 4.42105, -7.69696,
4.43372, -7.78947, 4.42926, -7.88302, 4.42681, -7.89474,
4.42623, -7.90214, 4.42105, -7.92933, 4.40321, -8.;
I want to interpolate it, but when performing interpolation, Interpolation[Data], it writes that some points corresponding to 1st coordinate are duplicated:
Interpolation::inddp: The point 4.42105` in dimension 1 is duplicated.
This is, however, not the case, and I can't find out a reason for this.
Can you please help me?
error interpolation data
add a comment |Â
up vote
4
down vote
favorite
Consider a set of data points
data = 1.76842, -4.05181, 1.78353, -4.08368, 1.7926, -4.10526,
1.83347, -4.19819, 1.83984, -4.21376, 1.87722, -4.31579,
1.8896, -4.35321, 1.91579, -4.44367, 1.93133, -4.50411,
1.93709, -4.52632, 1.95047, -4.57586, 1.97969, -4.64556,
2.0356, -4.73684, 2.04833, -4.75802, 2.06316, -4.78248,
2.11756, -4.86965, 2.16706, -4.94737, 2.18808, -4.97944,
2.21053, -5.01398, 2.25946, -5.08799, 2.30551, -5.15789,
2.33156, -5.19552, 2.35789, -5.23314, 2.40539, -5.30058,
2.45345, -5.36842, 2.47936, -5.40543, 2.50526, -5.43997,
2.55506, -5.50781, 2.60946, -5.57895, 2.6322, -5.60814,
2.65263, -5.63466, 2.70962, -5.70806, 2.77582, -5.78947,
2.78877, -5.80551, 2.8, -5.81898, 2.8685, -5.90214, 2.92031,
-5.96135, 2.94737, -5.9926, 2.95435, -6., 3.03285, -6.0884,
3.09474, -6.15707, 3.11604, -6.1801, 3.14424, -6.21053,
3.20008, -6.27056, 3.24211, -6.31538, 3.28413, -6.36102,
3.34169, -6.42105, 3.36933, -6.44984, 3.38947, -6.47122,
3.45452, -6.53865, 3.51554, -6.60115, 3.53684, -6.62294,
3.54037, -6.62654, 3.5449, -6.63158, 3.61053, -6.6986,
3.62607, -6.71464, 3.64794, -6.73684, 3.68421, -6.77385,
3.71213, -6.80222, 3.75113, -6.84211, 3.79762, -6.89062,
3.83158, -6.92516, 3.88353, -6.97841, 3.95477, -7.05263,
3.96866, -7.06733, 3.97895, -7.07854, 4.0509, -7.15543,
4.05278, -7.15769, 4.12632, -7.23931, 4.14733, -7.26316,
4.21626, -7.34519, 4.27368, -7.4192, 4.29268, -7.44655,
4.31168, -7.47368, 4.36291, -7.55674, 4.41472, -7.67516,
4.4176, -7.68421, 4.41817, -7.68832, 4.42105, -7.69696,
4.43372, -7.78947, 4.42926, -7.88302, 4.42681, -7.89474,
4.42623, -7.90214, 4.42105, -7.92933, 4.40321, -8.;
I want to interpolate it, but when performing interpolation, Interpolation[Data], it writes that some points corresponding to 1st coordinate are duplicated:
Interpolation::inddp: The point 4.42105` in dimension 1 is duplicated.
This is, however, not the case, and I can't find out a reason for this.
Can you please help me?
error interpolation data
1
f = Interpolation[DeleteDuplicatesBy[data, First]]
orf = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
1
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29
add a comment |Â
up vote
4
down vote
favorite
up vote
4
down vote
favorite
Consider a set of data points
data = 1.76842, -4.05181, 1.78353, -4.08368, 1.7926, -4.10526,
1.83347, -4.19819, 1.83984, -4.21376, 1.87722, -4.31579,
1.8896, -4.35321, 1.91579, -4.44367, 1.93133, -4.50411,
1.93709, -4.52632, 1.95047, -4.57586, 1.97969, -4.64556,
2.0356, -4.73684, 2.04833, -4.75802, 2.06316, -4.78248,
2.11756, -4.86965, 2.16706, -4.94737, 2.18808, -4.97944,
2.21053, -5.01398, 2.25946, -5.08799, 2.30551, -5.15789,
2.33156, -5.19552, 2.35789, -5.23314, 2.40539, -5.30058,
2.45345, -5.36842, 2.47936, -5.40543, 2.50526, -5.43997,
2.55506, -5.50781, 2.60946, -5.57895, 2.6322, -5.60814,
2.65263, -5.63466, 2.70962, -5.70806, 2.77582, -5.78947,
2.78877, -5.80551, 2.8, -5.81898, 2.8685, -5.90214, 2.92031,
-5.96135, 2.94737, -5.9926, 2.95435, -6., 3.03285, -6.0884,
3.09474, -6.15707, 3.11604, -6.1801, 3.14424, -6.21053,
3.20008, -6.27056, 3.24211, -6.31538, 3.28413, -6.36102,
3.34169, -6.42105, 3.36933, -6.44984, 3.38947, -6.47122,
3.45452, -6.53865, 3.51554, -6.60115, 3.53684, -6.62294,
3.54037, -6.62654, 3.5449, -6.63158, 3.61053, -6.6986,
3.62607, -6.71464, 3.64794, -6.73684, 3.68421, -6.77385,
3.71213, -6.80222, 3.75113, -6.84211, 3.79762, -6.89062,
3.83158, -6.92516, 3.88353, -6.97841, 3.95477, -7.05263,
3.96866, -7.06733, 3.97895, -7.07854, 4.0509, -7.15543,
4.05278, -7.15769, 4.12632, -7.23931, 4.14733, -7.26316,
4.21626, -7.34519, 4.27368, -7.4192, 4.29268, -7.44655,
4.31168, -7.47368, 4.36291, -7.55674, 4.41472, -7.67516,
4.4176, -7.68421, 4.41817, -7.68832, 4.42105, -7.69696,
4.43372, -7.78947, 4.42926, -7.88302, 4.42681, -7.89474,
4.42623, -7.90214, 4.42105, -7.92933, 4.40321, -8.;
I want to interpolate it, but when performing interpolation, Interpolation[Data], it writes that some points corresponding to 1st coordinate are duplicated:
Interpolation::inddp: The point 4.42105` in dimension 1 is duplicated.
This is, however, not the case, and I can't find out a reason for this.
Can you please help me?
error interpolation data
Consider a set of data points
data = 1.76842, -4.05181, 1.78353, -4.08368, 1.7926, -4.10526,
1.83347, -4.19819, 1.83984, -4.21376, 1.87722, -4.31579,
1.8896, -4.35321, 1.91579, -4.44367, 1.93133, -4.50411,
1.93709, -4.52632, 1.95047, -4.57586, 1.97969, -4.64556,
2.0356, -4.73684, 2.04833, -4.75802, 2.06316, -4.78248,
2.11756, -4.86965, 2.16706, -4.94737, 2.18808, -4.97944,
2.21053, -5.01398, 2.25946, -5.08799, 2.30551, -5.15789,
2.33156, -5.19552, 2.35789, -5.23314, 2.40539, -5.30058,
2.45345, -5.36842, 2.47936, -5.40543, 2.50526, -5.43997,
2.55506, -5.50781, 2.60946, -5.57895, 2.6322, -5.60814,
2.65263, -5.63466, 2.70962, -5.70806, 2.77582, -5.78947,
2.78877, -5.80551, 2.8, -5.81898, 2.8685, -5.90214, 2.92031,
-5.96135, 2.94737, -5.9926, 2.95435, -6., 3.03285, -6.0884,
3.09474, -6.15707, 3.11604, -6.1801, 3.14424, -6.21053,
3.20008, -6.27056, 3.24211, -6.31538, 3.28413, -6.36102,
3.34169, -6.42105, 3.36933, -6.44984, 3.38947, -6.47122,
3.45452, -6.53865, 3.51554, -6.60115, 3.53684, -6.62294,
3.54037, -6.62654, 3.5449, -6.63158, 3.61053, -6.6986,
3.62607, -6.71464, 3.64794, -6.73684, 3.68421, -6.77385,
3.71213, -6.80222, 3.75113, -6.84211, 3.79762, -6.89062,
3.83158, -6.92516, 3.88353, -6.97841, 3.95477, -7.05263,
3.96866, -7.06733, 3.97895, -7.07854, 4.0509, -7.15543,
4.05278, -7.15769, 4.12632, -7.23931, 4.14733, -7.26316,
4.21626, -7.34519, 4.27368, -7.4192, 4.29268, -7.44655,
4.31168, -7.47368, 4.36291, -7.55674, 4.41472, -7.67516,
4.4176, -7.68421, 4.41817, -7.68832, 4.42105, -7.69696,
4.43372, -7.78947, 4.42926, -7.88302, 4.42681, -7.89474,
4.42623, -7.90214, 4.42105, -7.92933, 4.40321, -8.;
I want to interpolate it, but when performing interpolation, Interpolation[Data], it writes that some points corresponding to 1st coordinate are duplicated:
Interpolation::inddp: The point 4.42105` in dimension 1 is duplicated.
This is, however, not the case, and I can't find out a reason for this.
Can you please help me?
error interpolation data
edited Sep 7 at 11:57
Michael E2
140k11191457
140k11191457
asked Sep 7 at 11:50
John Taylor
520211
520211
1
f = Interpolation[DeleteDuplicatesBy[data, First]]
orf = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
1
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29
add a comment |Â
1
f = Interpolation[DeleteDuplicatesBy[data, First]]
orf = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
1
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29
1
1
f = Interpolation[DeleteDuplicatesBy[data, First]]
or f = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
f = Interpolation[DeleteDuplicatesBy[data, First]]
or f = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
1
1
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
You can find the duplicated point with Position
:
Position[data, 4.42105`]
(* 79, 1, 84, 1 *)
However, Interpolation
is less sensitive than Position
in determining distinct points:
data2 = 1., 2., 1 + $MachineEpsilon, 2., 2., 2., 3., 2.;
Interpolation[data2]
Interpolation::inddp: The point 1.0000000000000002` in dimension 1 is duplicated.
In this case, the simple call to Position
fails, because all points are treated as distinct:
Position[data2, 1.0000000000000002`]
(* 2, 1 *)
Interpolation
is more sensitive than Equal
, so the following will identify the offending points and possibly others.
Position[data2, x_Real /; x == 1.0000000000000002`]
(* 1, 1, 2, 1 *)
Update: More possible debugging
It's bit embarrassing not to do what you exhort others to do when things seem awry, namely, MAG or Make-A-Graph; perhaps in this case, the advanced variant MAGS or Make-A-Graph-Stupid should be used.
A data plot suggests that if the data were stored as they were collected, then the dependent and independent variables are switched:
ListPlot[data]
Reversing them makes a plot that looks like a function:
ListPlot[Reverse /@ data]
And the following returns an InterpolatingFunction
without errors:
Interpolation[Reverse /@ data]
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
You can find the duplicated point with Position
:
Position[data, 4.42105`]
(* 79, 1, 84, 1 *)
However, Interpolation
is less sensitive than Position
in determining distinct points:
data2 = 1., 2., 1 + $MachineEpsilon, 2., 2., 2., 3., 2.;
Interpolation[data2]
Interpolation::inddp: The point 1.0000000000000002` in dimension 1 is duplicated.
In this case, the simple call to Position
fails, because all points are treated as distinct:
Position[data2, 1.0000000000000002`]
(* 2, 1 *)
Interpolation
is more sensitive than Equal
, so the following will identify the offending points and possibly others.
Position[data2, x_Real /; x == 1.0000000000000002`]
(* 1, 1, 2, 1 *)
Update: More possible debugging
It's bit embarrassing not to do what you exhort others to do when things seem awry, namely, MAG or Make-A-Graph; perhaps in this case, the advanced variant MAGS or Make-A-Graph-Stupid should be used.
A data plot suggests that if the data were stored as they were collected, then the dependent and independent variables are switched:
ListPlot[data]
Reversing them makes a plot that looks like a function:
ListPlot[Reverse /@ data]
And the following returns an InterpolatingFunction
without errors:
Interpolation[Reverse /@ data]
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
add a comment |Â
up vote
6
down vote
accepted
You can find the duplicated point with Position
:
Position[data, 4.42105`]
(* 79, 1, 84, 1 *)
However, Interpolation
is less sensitive than Position
in determining distinct points:
data2 = 1., 2., 1 + $MachineEpsilon, 2., 2., 2., 3., 2.;
Interpolation[data2]
Interpolation::inddp: The point 1.0000000000000002` in dimension 1 is duplicated.
In this case, the simple call to Position
fails, because all points are treated as distinct:
Position[data2, 1.0000000000000002`]
(* 2, 1 *)
Interpolation
is more sensitive than Equal
, so the following will identify the offending points and possibly others.
Position[data2, x_Real /; x == 1.0000000000000002`]
(* 1, 1, 2, 1 *)
Update: More possible debugging
It's bit embarrassing not to do what you exhort others to do when things seem awry, namely, MAG or Make-A-Graph; perhaps in this case, the advanced variant MAGS or Make-A-Graph-Stupid should be used.
A data plot suggests that if the data were stored as they were collected, then the dependent and independent variables are switched:
ListPlot[data]
Reversing them makes a plot that looks like a function:
ListPlot[Reverse /@ data]
And the following returns an InterpolatingFunction
without errors:
Interpolation[Reverse /@ data]
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
add a comment |Â
up vote
6
down vote
accepted
up vote
6
down vote
accepted
You can find the duplicated point with Position
:
Position[data, 4.42105`]
(* 79, 1, 84, 1 *)
However, Interpolation
is less sensitive than Position
in determining distinct points:
data2 = 1., 2., 1 + $MachineEpsilon, 2., 2., 2., 3., 2.;
Interpolation[data2]
Interpolation::inddp: The point 1.0000000000000002` in dimension 1 is duplicated.
In this case, the simple call to Position
fails, because all points are treated as distinct:
Position[data2, 1.0000000000000002`]
(* 2, 1 *)
Interpolation
is more sensitive than Equal
, so the following will identify the offending points and possibly others.
Position[data2, x_Real /; x == 1.0000000000000002`]
(* 1, 1, 2, 1 *)
Update: More possible debugging
It's bit embarrassing not to do what you exhort others to do when things seem awry, namely, MAG or Make-A-Graph; perhaps in this case, the advanced variant MAGS or Make-A-Graph-Stupid should be used.
A data plot suggests that if the data were stored as they were collected, then the dependent and independent variables are switched:
ListPlot[data]
Reversing them makes a plot that looks like a function:
ListPlot[Reverse /@ data]
And the following returns an InterpolatingFunction
without errors:
Interpolation[Reverse /@ data]
You can find the duplicated point with Position
:
Position[data, 4.42105`]
(* 79, 1, 84, 1 *)
However, Interpolation
is less sensitive than Position
in determining distinct points:
data2 = 1., 2., 1 + $MachineEpsilon, 2., 2., 2., 3., 2.;
Interpolation[data2]
Interpolation::inddp: The point 1.0000000000000002` in dimension 1 is duplicated.
In this case, the simple call to Position
fails, because all points are treated as distinct:
Position[data2, 1.0000000000000002`]
(* 2, 1 *)
Interpolation
is more sensitive than Equal
, so the following will identify the offending points and possibly others.
Position[data2, x_Real /; x == 1.0000000000000002`]
(* 1, 1, 2, 1 *)
Update: More possible debugging
It's bit embarrassing not to do what you exhort others to do when things seem awry, namely, MAG or Make-A-Graph; perhaps in this case, the advanced variant MAGS or Make-A-Graph-Stupid should be used.
A data plot suggests that if the data were stored as they were collected, then the dependent and independent variables are switched:
ListPlot[data]
Reversing them makes a plot that looks like a function:
ListPlot[Reverse /@ data]
And the following returns an InterpolatingFunction
without errors:
Interpolation[Reverse /@ data]
edited Sep 7 at 18:28
answered Sep 7 at 11:56
Michael E2
140k11191457
140k11191457
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
add a comment |Â
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
1
1
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
I considered closing the Q as a mistake, but then thought that pointing out debugging tools would be more helpful.
– Michael E2
Sep 7 at 12:10
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f181424%2finterpolation-of-data%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
f = Interpolation[DeleteDuplicatesBy[data, First]]
orf = Interpolation[DeleteDuplicates[data, #1[[1]] == #2[[1]] &]]
– Bob Hanlon
Sep 7 at 14:10
1
John, you may have figured this out on your own already, but I added an alternative way of interpreting the data.
– Michael E2
Sep 7 at 18:29