gnuplot を使おう。 その3at UNIXgnuplot を使おう。 その3 - 暇つぶし2ch■コピペモード□スレを通常表示□オプションモード□このスレッドのURL■項目テキスト977:887 22/12/06 01:24:00.71 .net (続き) int main () { string gnuplot_path ("gnuplot"); FILE fp (popen (gnuplot_path.c_str (), "w")); if (!fp) return -1; fprintf (fp, "reset\n"); fprintf (fp, "set yrange [-1:1]\n"); clock_t time0 (clock ()); for (double second (static_cast <double> (clock () - time0) / CLOCKS_PER_SEC); second < DURATION; second = static_cast <double> (clock () - time0) / CLOCKS_PER_SEC) { Series series; for (size_t i (0), last ((MAX - MIN) / INTERVAL); i < last; ++ i) { const double x (MIN + i * INTERVAL); series.insert (make_pair (x, sin (x - PHI + OMEGA * second))); } fprintf (fp, "set title 't = %1.2f'\n", second); fprintf (fp, "plot '-' title 'sin' with lines\n"); for (const Series::value_type &point: series) fprintf (fp, "%f %f\n", point.first, point.second); fprintf (fp, "e\n"); fflush (fp); } pclose (fp); return 0; } 次ページ最新レス表示レスジャンプ類似スレ一覧スレッドの検索話題のニュースおまかせリストオプションしおりを挟むスレッドに書込スレッドの一覧暇つぶし2ch