I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » Tutorials » C & C++ »

Lagrangian Interpolation


Warning: imagegif(/var/www/localhost/htdocs/images/avatars/Charlie Brown/Charlie_Brown_-_Charlie_Brown_50_0_thumb.gif): failed to open stream: Permission denied in /var/www/localhost/htdocs/php/functions/image_fn.php on line 144
TheCoder\′s Photo
28 Mar 16, 3:39AM
Lagrangian Interpolation
I want to write a code in C++ for the Lagrangian/Polynomial interpolation for the given equation:
28444/eq1.png
+

void Function(p_struct particle) {
 
for (int X = 0; X < Nx; ++X) {
   for (int Y = 0; Y < Ny; ++Y) {
       Ax[X][Y] = 0;
       Ay[X][Y] = 0;
   }
}
 
for (int n = 0; n < particle.num_nodes; ++n) {
   int xStart = static_cast <int> (particle.node[n].x - 3.0);
   int xEnd = static_cast <int> (particle.node[n].x + 3.0);
   int yStart = static_cast <int> (particle.node[n].y - 3.0);
   int yEnd = static_cast <int> (particle.node[n].y + 3.0);
   for (int X = xStart; X < xEnd; ++X) {
       for (int Y = yStart; Y <= yEnd; ++Y) {
          **// here I want to use Lagrangian Interpolation**
            const double xDistance = X - particle.node[n].x;
            const double yDistance = Y - particle.node[n].y;
            const double delta = dirac_4(xDistance, yDistance);
            Ax[X][Y] += (particle.node[n].Ax * delta);
            Ay[X][Y] += (particle.node[n].Ay * delta);
        }
    }
}
return;
}

How can I get interpolated values " Ax[X][Y] and Ay[X][Y]" by changing my code.

Best Regards

Currently you need to be logged in to leave a message.