Aller au contenu

Mathc initiation/0002

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_f.h
/* --------------------------------- */
/* save as  kg_f.h                   */
/* --------------------------------- */
void G_f_2d(
CTRL_splot  w,
double      step,
double    (*P_f)(double x)
)
{
FILE *fp = fopen("a_main.plt","w");

double i = w.xmin;

fprintf(fp," reset\n"
           " set zeroaxis lt 8\n"
           " set grid\n\n"
           " set size ratio -1\n"
           " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
           " \"fi\"  with line lt  7 lw 3\n\n",
             w.xmin,w.xmax,w.ymin,w.ymax);
  fclose(fp);
           
               
  fp = fopen("fi",  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_f)(i));
      i += step;
    }while(i <= w.xmax+step);
  fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */