pietrod21

rule90

Dec 22nd, 2011
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. int main(){
  6.   int i,l;
  7.  char array[2000], array1[2000];
  8.  
  9.  
  10.  FILE *fp;
  11.  FILE *fl;
  12.  
  13. fp=fopen("rule90.dat","w+");
  14. fl=fopen("rule90.gnu","w");
  15.  
  16.    for(i=0;i<2000;i++){ //inizializzo a zero
  17.     array1[i]=0;
  18.     array[i]=0;
  19.    }
  20.  
  21.    array[1000]=1;
  22.  
  23.     for(l=0;l<1000;l++){
  24.             for(i=0;i<2000;i++){ //determino linea successiva
  25.                 array1[i]=array[i-1] ^ array[i+1];
  26.                 if( array[i]== 1 )fprintf(fp,"%d  %d\n",i,l);
  27.             }
  28.  
  29.             for(i=0;i<2000;i++){ //sostituisco
  30.             array[i]=array1[i];
  31.             }
  32.     }
  33. fprintf(fl, " plot 'rule90.dat' lt rgb '#0AA424' \n set xlabel 'gittata massima' \n set ylabel 'dt' \n set term post col \n set output 'eull.ps' \n replot \n pause -1 \n  \n ");
  34. fclose(fl);
  35. fclose(fp);
  36. system("gnuplot rule90.gnu");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment