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.

Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.