gnuplot fourier series…

Gnuplot Examples
http://rustam.uwp.edu/gnuplot_examples.html

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
k=1.5
w=3.0
f(x,t)=sin(k*x-w*t)
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
e
#Looping

#Create a plot of many functions
dt=0.1
f(x,j)=sin(x-2.0*j*dt) 
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.
pi=3.1415926
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

kx=1.5
ky=1.0
w=3.0
f(x,y,t)=sin(kx*x+ky*y-w*t)
splot[0:5][0:5] f(x,y,1)

#Three dimensional graphs (contour)

set contour
set view 60,45
set isosample 20,20
f(x,y,t)=exp(-x*x-y*y)
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
f(x,y,t)=exp(-x*x-y*y)
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)
#Animation
#Create an animated GIF, a crude animation
set term gif tiny animate delay 10
set size 1.0, 0.8
dt=0.05
f(x,j)=sin(2.0*x-2.0*j*dt)+ sin(2.4*x-2.4*j*dt)
j=0
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