RE: interpolate in 2D

From: Olivier Couet <Olivier.Couet_at_cern.ch>
Date: Thu, 20 May 2010 12:57:54 +0200


Hello,

Can you send an example I can run ? The Interpolation on with a TGraph2D is done according to the Delaunay triangle lying above the x,y position you try to find a z value for. If there is not triangle above you get zero. Anyway, to help you further I need a small example (reproducing the problem) I can run.

Cheers,
Olivier

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Julia Campa Romero Sent: Thursday, May 20, 2010 12:38 PM
To: roottalk_at_root.cern.ch
Subject: [ROOT] interpolate in 2D

HI everybody,

I would like to interpolate in 2D dimension. I mean given a data set
(x,y,z) i would like to obtein the interpolated values for a new set of
(x,y).

I am trying with interpolate ( class TGraph2D) but I have some problems. Perhaps there are more options. The program I have written is below. ( the libraries here are not include). With this I am trying to reproduce the same intial data but some of them are equal to cero and others are ok. here is my program:


void readfort22(void){   

 // Fill the 2D graph

     ifstream in;
      in.open("fort.22");
      Double_t R, R1, M, M1, sigma, nu, ep, e1;


     TGraph2D *gr = new TGraph2D();

    //Fill the 2D Graph
      for (Int_t i=0;i<100;i++) {
            in >> R1>> M1 >> sigma >> nu >> ep >> e1;/
            if (!in.good()) break;

    cout<<R1<<" "<<M1<<" "<<ep<<endl;
 gr->SetPoint(i,R1,M1,ep);
  }
  gr->Draw("surf4");

     in.close();
 TGraph2D *gr2 = new TGraph2D();   

      in.open("fort.22");
    for (Int_t i=0;i<100;i++){

          in >> R1>> M1 >> sigma >> nu >> ep >> e1;
      ep = gr->Interpolate(R1,M1);

    cout<<R1<<" "<<M1<<" "<<ep<<endl;
    printf("eps1=%8f\n",ep);
    gr2->SetPoint(i,R1,M1,ep);
}

gr2->Draw("surf4");      

}



Thanks,

Julia



Confidencialidad:
Este mensaje y sus ficheros adjuntos se dirige exclusivamente a su destinatario y puede contener información privilegiada o confidencial. Si no es vd. el destinatario indicado, queda notificado de que la utilización, divulgación y/o copia sin autorización está prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente respondiendo al mensaje y proceda a su destrucción.

Disclaimer:
This message and its attached files is intended exclusively for its recipients and may contain confidential information. If you received this e-mail in error you are hereby notified that any dissemination, copy or disclosure of this communication is strictly prohibited and may be unlawful. In this case, please notify us by a reply and delete this email and its contents immediately.


Received on Thu May 20 2010 - 12:57:59 CEST

This archive was generated by hypermail 2.2.0 : Thu May 20 2010 - 17:50:01 CEST