Interpolation of points in 3D

dear all,

Is there a possibility to perform a 3D interpolation of points ?
I have a list of points :

`````` Double_t x2[] = {-5,-19/4,-9/2,-17/4,-4,-15/4,-7/2,-13/4,-3,-11/4,-5/2,-9/4,-2,-7/4,-3/2,-5/4,-1,-3/4,-1/2,-1/4,0,1/4,1/2,3/4,1,5/4,3/2,7/4,2,9/4,5/2,11/4,3,13/4,7/2,15/4,4,17/4,9/2,19/4,5};
Double_t y2[] = {-5,-19/4,-9/2,-17/4,-4,-15/4,-7/2,-13/4,-3,-11/4,-5/2,-9/4,-2,-7/4,-3/2,-5/4,-1,-3/4,-1/2,-1/4,0,1/4,1/2,3/4,1,5/4,3/2,7/4,2,9/4,5/2,11/4,3,13/4,7/2,15/4,4,17/4,9/2,19/4,5};
Double_t z2[] = {22.1328,19.9579,17.8955,15.9458,14.1086,12.384,10.7721,9.27274,7.886,6.61185,5.45031,4.40137,3.46504,2.6413,1.93017,1.33164,0.845715,0.472391,0.21167,0.0635511,0.0280347,0.105121,0.294809,0.597101,1.01199,1.53949,2.17959,2.93229,3.79759,4.7755,5.86601,7.06912,8.38483,9.81315,11.3541,13.0076,14.7737,16.6524,18.6438,20.7477,22.9642};``````

I would like to interpolate them, to find a 3D function that I would like after to minimize.

For the Interpolation I saw an Interpolation function in TH3 but I have absolutely no idea of how to use it.

Is there a simple way to perform these tasks?

Thanks in advance, best regards and happy new year

Jean-Philippe

create a TGraph2D and use TGraph2D::Interpolate

Rene

thanks for your reply. However, in the description of the function, I see it finds the z value given a (x,y) couple via Delaunay triangulation. I am not pretty sure that a Delaunay triangulation exists in my case. That is why, I don’t know if it is possible to interpolate a serie of points (x,y,z) where z is known and don’t need to be determined.

It is just the generalization of the 2D case where I know that it is possible to interpolate a serie of (x,y) couples where y=f(x).

Thanks in advance, regards

```{ Double_t x2[] = {-5,-19./4,-9./2,-17./4,-4,-15./4,-7./2,-13./4,-3,-11./4,-5./2,-9./4,-2,-7./4,-3./2,-5./4,-1,-3./4,-1./2,-1./4,0,1./4,1./2,3./4,1,5./4,3./2,7./4,2,9./4,5./2,11./4,3,13./4,7./2,15./4,4,17./4,9./2,19./4,5}; Double_t y2[] = {-5,-19./4,-9./2,-17./4,-4,-15./4,-7./2,-13./4,-3,-11./4,-5./2,-9./4,-2,-7./4,-3./2,-5./4,-1,-3./4,-1./2,-1./4,0,1./4,1./2,3./4,1,5./4,3./2,7./4,2,9./4,5./2,11./4,3,13./4,7./2,15./4,4,17./4,9./2,19./4,5}; Double_t z2[] = {22.1328,19.9579,17.8955,15.9458,14.1086,12.384,10.7721,9.27274,7.886,6.61185,5.45031,4.40137,3.46504,2.6413,1.93017,1.33164,0.845715,0.472391,0.21167,0.0635511,0.0280347,0.105121,0.294809,0.597101,1.01199,1.53949,2.17959,2.93229,3.79759,4.7755,5.86601,7.06912,8.38483,9.81315,11.3541,13.0076,14.7737,16.6524,18.6438,20.7477,22.9642}; TGraph2D *g2 = new TGraph2D((sizeof(x2)/sizeof(Double_t)), x2, y2, z2); TGraph *g = new TGraph((sizeof(x2)/sizeof(Double_t)), x2, z2); TCanvas *c = new TCanvas("c", "c"); c->Divide(1, 2); c->cd(1); gStyle->SetPalette(1); g2->SetMarkerStyle(20); g2->Draw("PCOL"); c->cd(2); g->SetMarkerStyle(20); g->Fit("pol2"); g->Draw("AP"); c->cd(0); }```