|
|
|
#include <stdio.h> int main() { int i; float x; printf("Enter initial guess =");scanf("%f",&x); for (i=0;i<100;i++) /* insert your iteration code */ printf("%f\n",x); return 0; } |
|
|
|
|
gnuplot > set title "My graph" gnuplot > plot x**3-x-1 gnuplot > plot sin(x) with dots (w d) gnuplot > plot sin(x) with impulse (w i) gnuplot > plot [-5:5] sin(x)/(x**2+1) gnuplot > plot [-pi:pi] sin(x), sin(2*x), sin(3*x) gnuplot > set xlabel "My x axis" gnuplot > set ylabel "My y axis" gnuplot > plot [-4:4] [0:10] x/exp(x) gnuplot > splot [-pi:pi] [-2*pi:3*pi] sin(x*y) gnuplot > plot [-4:4] [0:10] x/exp(x) gnuplot> set isosamples 100 gnuplot> set hidden3d gnuplot> set contour base gnuplot> splot [0:pi][0:pi] sin(x*y) gnuplot> gnuplot > quit |
#include <stdio.h> #include <math.h> int main() { int i; float x; for (i=0; i<10; i++) { x = 0.1*i; printf("%f %f\n", x , sin(x)); } return 0; } |
$ gcc -lm thisprogram.c $ a.out > junk.dat $ gnuplot gnuplot > plot "junk.dat" with lines gnuplot > plot "junk.dat", 3*x+12 |
cd "c:/tmp" set term gif size 320,240 set output "1.gif" plot sin(x) set output "2.gif" plot sin(2*x) set output "3.gif" plot sin(3*x) quit |
$ cd \tmp $ mergegif -l0 1.gif 2.gif 3.gif > animation.gif $ start animation.gif |
cd "c:/tmp" set term gif animate set output "animation.gif" plot sin(x) plot sin(2*x) plot sin(3*x) quit |