Mathc initiation/Fichiers h : g win
Installer ce fichier dans votre répertoire de travail.
![]() |
g_plt.h |
---|
/* ------------------------------ */
/* Save as g_win.h */
/* ------------------------------ */
void G_plot(
W_Ctrl W)
{
FILE *fp;
double a = -5.0;
fp = fopen("data","w");
while( a <= 5.0)
{ fprintf(fp," %6.3f %6.3f\n",a,f(a));
a += .1;
}
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 [%0.3f:%0.3f] [%0.3f:%0.3f] \\\n"
" \"data\",\\\n"
" %s\n"
" reset",
W.xmini,W.xmaxi,W.ymini,W.ymaxi,
feq);
fclose(fp);
}
/* ------------------------------ */
La fonction G_plot() est notre première fonction graphique.
Cette fonction créé un fichier que gnuplot sera capable d'afficher.
Dans cette version nous allons pouvoir contrôler la fenêtre de gnuplot.