gnuplot fourier series…

Gnuplot Examples

set xlabel "x (meters)"
set ylabel "y (meters)"
plot sin(x)
#Plot a versus user-defined variable
#The default variable is x, to change that to t is easy
f(x) = exp(-x**2 / 2)
plot [t=-4:4] f(t) title "Bell Curve", t**2 / 16 title "Parabola"
#Plot a non-smooth function
f1(x)=(x<=25) ? x**2 : 0
f2(x)=(x>25) ? 625+50*(x-25) : f1(x)
f3(x)=(x>100) ?  4375+50*(x-100)-(x-100)**2 : f2(x)
# velocity functions
v1(x)=(x<=25) ? 2*x : 0
v2(x)=(x>25) ? 50 : v1(x)
v3(x)=(x>100) ? 50-2*(x-100) : v2(x)
plot[0:125][0:60] v3(x)
#Plot a user defined function
set xlabel "x (meters)"
set ylabel "y (meters)"
plot[0:5] f(x,0), f(x,0.1), f(x,0.2)
#Plot a set of points
#This is very useful if the data points are generated by a program, cut and paste them into gnuplot.
plot[0:3][0:10] x*x, "-"
1 1
2 4
3 9

#Create a plot of many functions
plot for [j=0:10] f(x,j)
#Plot a recursive function
#This is VERY cool, plot a Fourier series by defining it recursively and then plot its partial sums.
f(x,n)=(n>=0) ? sin((2*n+1)*x)/(2*n+1)+f(x,n-1) : 0 
plot[-pi:pi] for [n=0:6] f(x,n)
#Three dimensional graphs

splot[0:5][0:5] f(x,y,1)

#Three dimensional graphs (contour)

set contour
set view 60,45
set isosample 20,20
splot[-5:5][-5:5] f(x,y,1)
#Three dimensional graphs (contour)

set contour
set view 0,0
set isosample 20,20
set nosurface
splot[-5:5][-5:5] f(x,y,1)
#Parametric surface plot

set dummy u,v
set key bmargin center horizontal Right noreverse enhanced autotitles nobox
set parametric
set view 45, 50, 1, 1
set isosamples 40, 20
set hidden3d # this makes the foreground obscure the background
set ztics border in scale 1,0.5 nomirror norotate  
set title "Parametric Sphere" 
set urange [ -1.57080 : 1.57080 ] noreverse nowriteback
set vrange [ 0.00000 : 6.28319 ] noreverse nowriteback
splot cos(u)*cos(v),cos(u)*sin(v),sin(u)
#Create an animated GIF, a crude animation
set term gif tiny animate delay 10
set size 1.0, 0.8
f(x,j)=sin(2.0*x-2.0*j*dt)+ sin(2.4*x-2.4*j*dt)
plot[-10:10] f(x,0)
plot[-10:10] f(x,1)
plot[-10:10] f(x,2)
plot[-10:10] f(x,3)
plot[-10:10] f(x,4)
plot[-10:10] f(x,5)
plot[-10:10] f(x,6)
plot[-10:10] f(x,7)
plot[-10:10] f(x,8)
plot[-10:10] f(x,9)
plot[-10:10] f(x,10)
plot[-10:10] f(x,11)
plot[-10:10] f(x,12)
plot[-10:10] f(x,13)
plot[-10:10] f(x,14)
plot[-10:10] f(x,15)
plot[-10:10] f(x,16)
plot[-10:10] f(x,17)
plot[-10:10] f(x,18)
plot[-10:10] f(x,19)
plot[-10:10] f(x,20)
plot[-10:10] f(x,21)
plot[-10:10] f(x,22)
plot[-10:10] f(x,23)
plot[-10:10] f(x,24)
plot[-10:10] f(x,25)
plot[-10:10] f(x,26)
plot[-10:10] f(x,27)
plot[-10:10] f(x,28)
plot[-10:10] f(x,29)
plot[-10:10] f(x,30)
곪아 썩어가는 것들을 두 눈에 담기


Leave a Reply