Facebook
From Gamboge Cat, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 59
  1. ofstream fout("CmdMedio.gpl");
  2.  
  3.         fout << "#ESTE ES UN SCRIPT PARA CASO MEDIO\n";
  4.         fout << "set title \"" << nombre_metodo << "\""<< endl;
  5.         fout << "set key left vertical inside " << endl;
  6.         fout << "set xlabel \" Talla (n)\"" << endl;
  7.         fout << "set ylabel \" Talla (ms)\"" << endl;
  8.        
  9.         switch (orden) {
  10.  
  11.         case CUADRADO:
  12.                 fout << "Cuadrado(x)= a*x*x+b*x+c" << endl;
  13.                 fout << "fit Cuadrado(x) \"" + nombre_metodo + ".dat\" using 1:2 via a, b, c" << endl;
  14.                 fout << "plot \"" + nombre_metodo + ".dat\" using 1:2 title \"" + nombre_metodo + "\", Cuadrado(x)" << endl;
  15.                 break;
  16.         case NLOGN:
  17.                 fout << "NLogN(x)= a*x*log(x)+b*x+c" << endl;
  18.                 fout << "fit NlogN(x) \"" + nombre_metodo + ".dat\" using 1:2 via a, b, c" << endl;
  19.                 fout << "plot \"" + nombre_metodo + ".dat\" using 1:2 title \"" + nombre_metodo + "\", NlogN(x)" << endl;
  20.                 break;
  21.         case N:
  22.                 fout << "N(x)= a*x*+b" << endl;
  23.                 fout << "fit N(x) \"" + nombre_metodo + ".dat\" using 1:2 via a, b" << endl;
  24.                 fout << "plot \"" + nombre_metodo + ".dat\" using 1:2 title \"" + nombre_metodo + "\", N(x)" << endl;
  25.                 break;
  26.         case LOGN:
  27.                 fout << "LogN(x)= a*log(x)+b" << endl;
  28.                 fout << "fit LogN(x) \"" + nombre_metodo + ".dat\" using 1:2 via a, b" << endl;
  29.                 fout << "plot \"" + nombre_metodo + ".dat\" using 1:2 title \"" + nombre_metodo + "\", LogN(x)" << endl;
  30.                 break;
  31.         case LOGLOGN:
  32.                 fout << "LogLogN(x)= a*log(log(x))+b" << endl;
  33.                 fout << "fit LogLogN(x) \"" + nombre_metodo + ".dat\" using 1:2 via a, b" << endl;
  34.                 fout << "plot \"" + nombre_metodo + ".dat\" using 1:2 title \"" + nombre_metodo + "\", LogLogN(x)" << endl;
  35.                 break;
  36.         }
  37.  
  38.         fout << "set terminal pdf" << endl;
  39.         fout << "set output\"" + nombre_metodo + ".pdf\"" << endl;
  40.  
  41.         fout << "replot" << endl;
  42.         fout << "pause - 1" << endl;
  43.         fout.close();
  44.  
  45.         system("CmdMedio.gpl");
  46.         cout << "Grafica creada en " << nombre_metodo << ".pdf" << endl;
  47.         system("pause");