Aller au contenu

Mathc initiation/Fichiers h : g plt

Un livre de Wikilivres.
Version datée du 16 avril 2020 à 10:07 par DannyS712 (discussion | contributions) (<source> -> <syntaxhighlight> (phab:T237267))


Installer ce fichier dans votre répertoire de travail.

g_plt.h
/* ------------------------------ */
/* Save as g_plt.h                */
/* ------------------------------ */
void G_plot(void)
{
FILE *fp;
double a = 0.0;

   fp = fopen("data","w");
   
   for(a = -5.0; a <= 5.0; a+=.2)
   
        fprintf(fp," %6.3f   %6.3f\n",a,f(a));
        
  fclose(fp);


  fp = fopen("a_main.plt","w");
  
   fprintf(fp,"# Fichier de commande pour gnuplot          \n"
              "# En ligne de commande : load \"a_main.plt\"\n"
              "#\n"
              " set zeroaxis\n"
              " plot \"data\",\\\n"
              " %s\n"
              " reset",feq);
  fclose(fp);

  printf("load \"a_main.plt\" with gnuplot.");
}
/* ------------------------------ */

La fonction G_plot() est notre première fonction graphique.

Cette fonction créé un fichier que gnuplot sera capable d'afficher.