Mathc initiation/a50
Installer et compiler ces fichiers dans votre répertoire de travail.
![]() |
c01a.c |
---|
/* --------------------------------- */
/* save as c01a.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
p.xmin = -3; p.xmax = 3;
p.ymin = -3; p.ymax = 3;
p.zmin = -0; p.zmax = 1;
p.rot_x = 55; p.rot_z = 57;
p.scale = 1; p.scale_z = 1;
pt2d step = i_pt2d(.2,.2);
clrscrn();
printf(" f : (x,y)-> %s\n\n\n", feq);
G_3dp( p,
f,
step);
printf(" Open the file \"a_main.plt\" with gnuplot.\n\n");
stop();
return 0;
}
/* --------------------------------- */
/* --------------------------------- */
Cette fois, on dessine la fonction en calculant les points à partir de sa définition.
Fichier de commande gnuplot :
reset
set xlabel "<x>"
set ylabel "<y>"
set zlabel "<z>"
set samples 40
set isosamples 40
set view 55.000, 57.000, 1.000, 1.000
set xrange [-3.000:3.000]
set yrange [-3.000:3.000]
set zrange [0.000:1.000]
splot "a_ka" with lines,\
"a_kb" with lines
Attention cet exemple ne fonctionne que si le langage C à créé les fichiers a_ka et a_ka.
Exemple de sortie écran 1 :
f : (x,y)-> 1/(x*x + y*y + 1)
Open the file "a_main.plt" with gnuplot.
Press return to continue.