1
$\begingroup$

I have the following 2D data set:

rrange = Range[1.5, 30, Abs[1.5 - 30]/9];
thetarange = Range[0.1, Pi - 0.1, (Pi - 0.2)/9];
coefflistupExpl = {{-135.14511024461106`, -491.0604985408635`, -881.9421291151137`,-1260.0984328238856`, -1513.9513638338296`, -1513.9513638338299`,-1260.0984328238856`, -881.9421291151135`, -491.06049854086405`,-135.1451102446111`}, {-1.5142531933295087`, -0.37232388448807263`,-0.2331372158847184`, -0.18715805003653702`, -0.17086515888649814`,-0.17086515888649814`, -0.187158050036537`, -0.23313721588471834`,-0.3723238844880723`, -1.514253193329507`}, {-0.5727476098161932`,-0.1395022760893628`, -0.08586657085967929`, -0.0677270725405478`,-0.06115525894956358`, -0.06115525894956358`, -0.06772707254054777`,-0.08586657085967928`, -0.1395022760893627`, -0.5727476098161925`},{-0.259039791853082`, -0.06288669153708114`, -0.038477816530581944`,-0.030163367358386196`, -0.027132279009877695`,-0.027132279009877695`, -0.030163367358386192`,-0.03847781653058193`, -0.06288669153708111`, -0.2590397918530817`},{-0.1292779426088209`, -0.03133326914673598`, -0.019114511395125464`,-0.01493815213757028`, -0.013411227032263872`,-0.013411227032263872`, -0.014938152137570276`,-0.01911451139512546`, -0.03133326914673597`, -0.12927794260882072`},{-0.06862807437799888`, -0.016617240479419433`,-0.010119133584897298`, -0.007893648637412628`,-0.007078629937110175`, -0.007078629937110175`,-0.007893648637412628`, -0.010119133584897294`,-0.016617240479419426`, -0.0686280743779988`},{-0.038026791744121956`, -0.009201614269998633`,-0.005596708070678661`, -0.004360468819581065`,-0.00390723960010555`, -0.00390723960010555`, -0.004360468819581064`,-0.0055967080706786606`, -0.009201614269998628`,-0.03802679174412191`}, {-0.021767232119110393`,-0.0052646932925957575`, -0.0031993992562647103`,-0.0024904749577585525`, -0.002230367642969974`,-0.002230367642969974`, -0.0024904749577585516`,-0.0031993992562647094`, -0.005264693292595755`,-0.02176723211911036`}, {-0.012804905748478031`,-0.0030959032771096778`, -0.0018801502157455158`,-0.001462531784991384`, -0.0013092141328043484`,-0.0013092141328043484`, -0.0014625317849913837`,-0.0018801502157455151`, -0.0030959032771096747`,-0.012804905748478014`}, {-0.007732194246853996`,-0.0018688756462285204`, -0.001134336349530597`,-0.0008818640583349311`, -0.0007891292257421068`,-0.0007891292257421068`, -0.0008818640583349306`,-0.001134336349530597`, -0.0018688756462285191`,-0.0077321942468539856`}};

And I want to generate an interpolating function matching the data. However, my naive attempt with the following code failed.

 Flatten[Table[{{rrange[[k]], thetarange[[j]]}, 
 coefflistupExpl[[k, j]]}, {k, 1, 10}, {j, 1, 10}], 1] // N;
 ff = Interpolation[%];
 Plot3D[ff[r, th], {r, 2, 10}, {th, 10^-1, Pi - 10^-1}]

 Flatten[Table[{rrange[[k]], thetarange[[j]], 
 coefflistupExpl[[k, j]]}, {k, 1, 10}, {j, 1, 10}], 1];
 ListPlot3D[%]

The interpolating function produced by the above code is

enter image description here

whereas the data looks like:

enter image description here

I suspect that Interpolation has problems with the diverging behavior of these data at 0 and Pi, but that's why I already cut out a large piece of the region close to 0 and Pi, though, as you can see, without success. Is there a way to construct a reliable interpolating function for the whole domain?

$\endgroup$
1
$\begingroup$

This seems to look better

Flatten[Table[{{rrange[[k]], thetarange[[j]]}, 
coefflistupExpl[[k, j]]}, {k, 1, 10}, {j, 1, 10}], 1] // N;
ff = Interpolation[%, InterpolationOrder -> 1];
v = Plot3D[ff[r, th], {r, 2, 30}, {th, 10^-1, Pi - 10^-1}]

Flatten[Table[{rrange[[k]], thetarange[[j]], 
coefflistupExpl[[k, j]]}, {k, 1, 10}, {j, 1, 10}], 1];
Show[ListPointPlot3D[%], v]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.