Aller au contenu

Mathc initiation/a309

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_uv.h
/* --------------------------------- */
/* save as kg_uv.h                   */
/* --------------------------------- */
void   G_uv(
CTRL_splot w,
double ax,
double bx,
pt2d    d,
double step,
double (*P_v)(double x),
double (*P_u)(double x)
)
{
double  i;

FILE   *fp = fopen("a_main.plt","w");

 fprintf(fp," set zeroaxis lt 8\n" 
            " set grid\n\n" 
            " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
            " \"ab\"    with line   lt 7 lw 2,\\\n" 
            " \"vx\"    with line   lt 7 lw 2,\\\n" 
            " \"ux\"    with line   lt 7 lw 2,\\\n" 
            " \"point\" with linesp lt 7 ps 3   \n"           
            " reset\n\n",
              w.xmin,w.xmax,w.ymin,w.ymax);
  fclose(fp);

 fp = fopen("ab",  "w");
 fprintf(fp," %0.6f   %0.6f  \n", ax, ((*P_v)(ax)));
 fprintf(fp," %0.6f   %0.6f\n\n", ax, ((*P_u)(ax))); 
 fprintf(fp," %0.6f   %0.6f  \n", bx, ((*P_v)(bx)));
 fprintf(fp," %0.6f   %0.6f  \n", bx, ((*P_u)(bx)));
  fclose(fp);

 fp = fopen("vx",  "w");
  i = ax;
  do{
     fprintf(fp," %0.6f   %0.6f\n", i, ((*P_v)(i)));
     i += step;
     }while(i <=  bx);
  fclose(fp);

 fp = fopen("ux",  "w");
  i = ax;
  do{
     fprintf(fp," %0.6f   %0.6f\n", i, ((*P_u)(i)));
     i += step;
     }while(i <=  bx);
  fclose(fp);
  
 fp = fopen("point","w");
      fprintf(fp,"  %6.5f  %6.5f  \n", d.x,d.y);
   fclose(fp);
             
  printf(" ... load \"a_main.plt\" ... with gnuplot.\n\n");             
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.