Group Abstract Group Abstract

Message Boards Message Boards

Avoid bumps between the interpolation points?

Posted 7 years ago

Hi

I have created this table based on some measurements:

t1 = {{59.38367090333329`, 460.6078253228267`, 
    805.`}, {302.1048538104013`, 461.72905098444113`, 
    805.`}, {547.9488192843321`, 463.02864907223164`, 
    805.`}, {796.9515493592204`, 464.5131337727569`, 
    805.`}, {1044.117089366742`, 466.15405911851997`, 
    805.`}, {1292.7722081900117`, 467.9731580365426`, 
    805.`}, {1539.9999999896709`, 469.94915430816627`, 
    805.`}, {1782.0000034310413`, 472.044969384517`, 
    805.`}, {105.00000808358162`, 407.8152230640072`, 
    737.`}, {334.9999977206025`, 408.4233494537993`, 
    737.`}, {567.057308415782`, 409.3090295247622`, 
    737.`}, {802.8580589648042`, 410.48897193863866`, 
    737.`}, {1037.237337936031`, 411.94146966973227`, 
    737.`}, {1273.0152354809818`, 413.6839584671484`, 
    737.`}, {1507.2762537494054`, 415.69468027459317`, 
    737.`}, {1739.3711147816339`, 417.9614994255005`, 
    737.`}, {142.9271728348491`, 362.98142270385904`, 
    674.`}, {361.8612671904232`, 363.3384564434068`, 
    674.`}, {583.9999999985181`, 364.0357576492104`, 
    674.`}, {809.4574404989381`, 365.08855244434045`, 
    674.`}, {1033.856348762275`, 366.4815945372955`, 
    674.`}, {1257.468760868694`, 368.2123237190352`, 
    674.`}, {1481.4381598843315`, 370.28860344494564`, 
    674.`}, {1701.6216781072417`, 372.66419814881544`, 
    674.`}, {178.32843037296428`, 321.1835833890642`, 
    609.`}, {388.484889977956`, 321.40820726451074`, 
    609.`}, {600.5275027421441`, 321.9861796041954`, 
    609.`}, {813.9999990985353`, 322.9245291080465`, 
    609.`}, {1029.620634032539`, 324.2354156312897`, 
    609.`}, {1243.9085285088286`, 325.8997356407203`, 
    609.`}, {1455.7605555458435`, 327.8994299932857`, 
    609.`}, {1666.292540689685`, 330.23564664161484`, 
    609.`}, {216.10802746667068`, 275.4492342523438`, 
    532.`}, {416.6558516294634`, 275.53342140572823`, 
    532.`}, {617.2563281659676`, 275.9827994908636`, 
    532.`}, {820.0000037082533`, 276.80806921626737`, 
    532.`}, {1023.7722087242142`, 278.0134315659101`, 
    532.`}, {1225.9999999741383`, 279.5822418581565`, 
    532.`}, {1428.9999989295727`, 281.5303375439369`, 
    532.`}, {1629.999999430509`, 283.8277373940662`, 
    532.`}, {248.53724652823018`, 238.54981863976835`, 
    463.`}, {439.18925324851625`, 238.80612906023327`, 
    463.`}, {631.3706009533535`, 239.34532844098712`, 
    463.`}, {825.8134355079837`, 240.17782399245382`, 
    463.`}, {1020.2897379509311`, 241.29916698823834`, 
    463.`}, {1213.1360344651664`, 242.69622059131342`, 
    463.`}, {1407.999741042584`, 244.39626900334042`, 
    463.`}, {1599.5687709712263`, 246.35014380799012`, 
    463.`}, {1787.4226509663818`, 248.53819038476695`, 
    463.`}, {271.0657662088092`, 211.71898893993335`, 
    408.`}, {456.43050079006576`, 211.7850360139266`, 
    408.`}, {641.7978478536077`, 212.19359072836482`, 
    408.`}, {828.8237814737055`, 212.95292078111146`, 
    408.`}, {1017.3333344006862`, 214.07109991436857`, 
    408.`}, {1204.5618400789936`, 215.53229717347673`, 
    408.`}, {1390.9054195586284`, 217.33353626938685`, 
    408.`}, {1575.2612110747373`, 219.45616854238585`, 
    408.`}, {1759.7862978322516`, 221.91999800068285`, 
    408.`}, {292.1315335958507`, 186.860580906395`, 
    355.`}, {471.0719872967465`, 186.91834150625527`, 
    355.`}, {651.658904114947`, 187.2968252823938`, 
    355.`}, {831.6428571428572`, 187.9940941811421`, 
    355.`}, {1012.1436516800293`, 189.0142565906517`, 
    355.`}, {1194.6990204908377`, 190.37288999778892`, 
    355.`}, {1375.9999881839437`, 192.0475161121808`, 
    355.`}, {1556.257081082542`, 194.03391237137524`, 
    355.`}, {1732.999677302721`, 196.2927518829849`, 
    355.`}, {316.46464970605615`, 157.9294056863523`, 
    288.`}, {487.67430489981774`, 157.97024516892282`, 
    288.`}, {661.0000002430351`, 158.3268201771229`, 
    288.`}, {835.3009439778589`, 159.00525027047658`, 
    288.`}, {1010.7077015613859`, 160.0117893929858`, 
    288.`}, {1185.0000016603942`, 161.33367302079085`, 
    288.`}, {1358.145993619255`, 162.96441993659712`, 
    288.`}, {1531.2029453576997`, 164.91059363852386`, 
    288.`}, {1702.8944365878237`, 167.15386331428869`, 
    288.`}, {338.33333451334795`, 132.14915289101697`, 
    223.`}, {503.2459262374899`, 132.11558120751215`, 
    223.`}, {671.0004795976905`, 132.40819052501732`, 
    223.`}, {840.5536375302611`, 133.03880707003157`, 
    223.`}, {1008.4570411555752`, 133.99504573065738`, 
    223.`}, {1175.963574325552`, 135.2779906894148`, 
    223.`}, {1343.5513506868613`, 136.8903742788726`, 
    223.`}, {1510.0000115678417`, 138.817348670245`, 
    223.`}, {1674.9999999999918`, 141.0477686774915`, 
    223.`}, {350.99999380302603`, 116.90822053720866`, 
    183.`}, {514.0671171059885`, 116.94958608049276`, 
    183.`}, {676.9667769861602`, 117.28513179747299`, 
    183.`}, {841.4065832838452`, 117.92210507789608`, 
    183.`}, {1006.1637933285251`, 118.8608344427576`, 
    183.`}, {1170.9999969124117`, 120.10104661260853`, 
    183.`}, {1334.6666665674518`, 121.63036720685305`, 
    183.`}, {1497.9995757246722`, 123.45250897186023`, 
    183.`}, {1660.0000007727779`, 125.55181543446656`, 
    183.`}, {364.7129157021116`, 102.22121405756394`, 
    142.`}, {523.6258843337882`, 102.20699149959746`, 
    142.`}, {683.3584648784453`, 102.5035187262144`, 
    142.`}, {843.0006545034189`, 103.11123631583024`, 
    142.`}, {1004.2382784506284`, 104.04097907092071`, 
    142.`}, {1165.0000026512294`, 105.2840959415858`, 
    142.`}, {1325.5485837220508`, 106.84058825739507`, 
    142.`}, {1486.2243923682963`, 108.71350297461456`, 
    142.`}, {1643.7398466655393`, 110.85565093405619`, 
    142.`}, {375.109403394961`, 88.98827071333633`, 
    103.`}, {531.2145477204673`, 88.99097566632297`, 
    103.`}, {688.000036392037`, 89.29811127924387`, 
    103.`}, {844.8739037593392`, 89.91075882235305`, 
    103.`}, {1003.0671171395852`, 90.8378475529598`, 
    103.`}, {1158.9670988358632`, 92.05535977785408`, 
    103.`}, {1316.868292022846`, 93.59597795412076`, 
    103.`}, {1475.0752419264852`, 95.44991694512463`, 
    103.`}, {1629.138732798296`, 97.55384189474498`, 
    103.`}, {384.6394986714535`, 79.623859374394`, 
    74.`}, {537.354005992903`, 79.6358542340854`, 
    74.`}, {691.8007090754759`, 79.93754807064624`, 
    74.`}, {846.7639291247217`, 80.5329091391809`, 
    74.`}, {1001.6954882282583`, 81.42120556164625`, 
    74.`}, {1156.5889867600415`, 82.60220284883054`, 
    74.`}, {1312.3711148995847`, 84.08538390189248`, 
    74.`}, {1466.0000058498538`, 85.83820360292621`, 
    74.`}, {1620.5773498531064`, 87.89263846120302`, 
    74.`}, {395.6905989158953`, 65.59518831071114`, 
    30.`}, {546.905419535318`, 65.66473219542159`, 
    30.`}, {698.3506406256911`, 66.01366071117941`, 
    30.`}, {847.6932719721631`, 66.63144260934908`, 
    30.`}, {1000.8047566046254`, 67.54697432996589`, 
    30.`}, {1152.6010754848905`, 68.73664705295923`, 
    30.`}, {1303.0146371379062`, 70.19244633900956`, 
    30.`}, {1453.6976229284448`, 71.92729087564645`, 
    30.`}, {1606.1682370292974`, 73.96434484848521`, 30.`}};

It looks fairly regular and smooth, even though the grid is not evenly spaced:

enter image description here

I make the Interpolation:

In[309]:= f1 = Interpolation[t1]

During evaluation of In[309]:= Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1.

Out[309]= InterpolatingFunction[{{59.38, 1787.42}, {65.6, 472.04}}, <>]

-and get the warning that the Interpolation is reduced to 1. This is fine.

However, it seems that Mathematica makes some bumps in the Interpolating function:

p1 = Plot3D[f1[x, y], {x, 300, 1600}, {y, 320, 375}];
p2 = ListPointPlot3D[t1, AxesLabel -> {"x", "y", "f1"}, 
   PlotStyle -> {Red, PointSize[0.02], Mesh -> None}];
Show[p1, p2]

interpolation function

I don't quite understand why Mathematica makes these fine bumps between the interpolation points. Can anyone help?

Henrik

POSTED BY: Henrik Pedersen
4 Replies

Hi Henrik, the problem is that your data do not consist in an array. You could try to make an array of the same size (approximatively):

f1 = Interpolation[t1]
{xmin, xmax} = {300, 1600};
{ymin, ymax} = {320, 375};

and afterward use NURBS. "Oversampling" your function:

npts = 30;
don0 = Table[{i, j, 
    f1[xmin + i (xmax - xmin)/npts, ymin + j (ymax - ymin)/npts]}, {i,
     npts - 1}, {j, npts - 1}];
Pl1 = Graphics3D[BSplineSurface[don0]];
Show[Graphics3D[{PointSize[Medium], Red, Map[Point, don0]}, 
  BoxRatios -> 1], Pl1, ImageSize -> Large]

You obtain a plot like yours, with bumps. With a smaller sample, you can filter these bumps:

npts = 10;
don1 = Table[{i, j, 
    f1[xmin + i (xmax - xmin)/npts, ymin + j (ymax - ymin)/npts]}, {i,
     npts - 1}, {j, npts - 1}];
Pl2 = Graphics3D[BSplineSurface[don1]];
Show[Graphics3D[{PointSize[Medium], Red, Map[Point, don1]}, 
  BoxRatios -> 1], Pl2, ImageSize -> Large]

Now, do you want to recover filtered data (at the 130 initial positions) from this spline? It should be possible... You could also use a product of Bernstein polynomials, for the same purpose.

Hope this helps!

Claude

POSTED BY: Claude Mante
POSTED BY: Henrik Schachner
Anonymous User
Anonymous User
Posted 7 years ago
POSTED BY: Anonymous User

I don't know. But perhaps a different approach could be useful:

ff = Fit[t1, {1, x, y, x y, x x, y y}, {x, y}]
p1 = Plot3D[ff /. {x -> xx, y -> yy}, {xx, 300, 1600}, {yy, 320, 375},
   Mesh -> None, PlotStyle -> Opacity[.5]]; 
p2 = Graphics3D[{Red, PointSize[.02], Point /@ t1}];
Show[p1, p2]
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard