Teknik Komputasi >> Interpolasi Kuadratik

// Interpolasi Kuadratik
# include <stdio.h>
# include <math.h>
# include <conio.h>
# include <iostream.h>

float x1, y1, x2, y2, x3, y3, x, P1, P2, P3, y ;

void main ( )
{
cout<<"****** PROGRAM INTERPOLASI KUADRATIK *******\n";
cout<<"\nInput data x[1] = "; cin>>x1;
   cout<<"Input data y[1] = "; cin>>y1;
   cout<<"Input data x[2] = "; cin>>x2;
   cout<<"Input data y[2] = "; cin>>y2;
   cout<<"Input data x[3] = "; cin>>x3;
   cout<<"Input data y[3] = "; cin>>y3;
  cout<<"\nInput x = "; cin>>x;

P1 = y1*((x - x2)*(x - x3)/(x1 - x2)*(x1 - x3)) ;
P2 = y2*((x - x1)*(x - x3)/(x2 - x1)*(x2 - x3)) ;
P3 = y3*((x - x1)*(x - x2)/(x3 - x1)*(x3 - x2)) ;
   y = P1 + P2 + P3 ;

cout<<"\n==> Hasil perhitungan y = "<<y<<endl;
cout<<"\nTitik Terbaru adalah ("<<x<<" , "<<y<<" )";
   getch();
}

Berkomentar yang sopan ya, Terimakasih sahabat..
EmoticonEmoticon