gnuplot を使おう。 その3 (944レス)
上下前次1-新
888: 887 2022/12/06(火)01:24 AAS
(続き)
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;
}
上下前次1-新書関写板覧索設栞歴
あと 56 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 1.351s*