Mathc initiation/Fichiers h : g xstep
Installer ce fichier dans votre répertoire de travail.
![]() |
g_plt.h |
---|
/* ------------------------------ */
/* Save as g_xstep.h */
/* ------------------------------ */
void G_plot(
W_Ctrl W,
x_Ctrl V)
{
FILE *fp;
double a = V.xmini;
fp = fopen("data","w");
while( a <= V.xmaxi)
{
fprintf(fp," %6.3f %6.3f\n",a,f(a));
a += V.step;
}
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, mais aussi contrôler le dessin de la fonction en contrôlant les valeurs des x.