x(t) = t-sin(t)
y(t) = 1-cos(t)
# cycloid
if (!exist("Qm")) Qm = 2.5*pi
set parametric
set size ratio -1
unset key
set border 1 lc "white"
set ytics axis nomirror 1 tc "white"
set xtics nomirror 1
set trange [0:Qm]
set term wxt size 640,480 backg "#003344"
# please change to 'qt' if need
set xr [-1:Qm+1]
set yr [0:2]
set yzeroaxis lw 1 lt 1 lc "white"
N = 100
do for[i = 0:N] { #animating on display
q = Qm/N*i
set obj 1 circle at q,1 size 1 lw 2 fs solid fc "gray"
set arrow 1 from q,1 to x(q),y(q) nohead lc "purple" lw 2
set tr [0:q]
plot x(t),y(t) lw 2 lc "gold"
pause 0.05
}
set term pngcairo size 480,360 font ",8" backg "#003344"
do for[i = 0:N] {
q = Qm/N*i
set obj 1 circle at q,1 size 1 lw 2 fs solid fc "gray"
set arrow 1 from q,1 to x(q),y(q) nohead lc "purple" lw 2
set tr [0:q]
set out sprintf("im%03d.png",i)
plot x(t),y(t) lw 2 lc "gold"
}
system("convert -adjoin -delay 5 im*.png cycloid.gif");
system("rm im*.png")
|