################################################################# # Hochschule Heilbronn kr 6/2006 # # Physik für Ingenieure # # 4.1. Schwingungen # # Fourier-Reihe für Rechteck und Sägezahn # # # # fourier_rechteck_saegezahn.plt # ################################################################# # reset # unset mouse # set xzeroaxis lt -1 set samples 1000 set grid set xrange [0:15.] # # rekursive Def. der Fourier-Reihe f. Rechteck # !!!! n muss u n gerade sein !!!! # re(x,n)=n<2 ? sin(x) : sin(n*x)/n + re(x,n-2) # # dto. Saegezahn (n ganzzahlig!) # sz(x,n)=n<2 ? sin(x) : sin(n*x)/n + sz(x,n-1) print "***************************************************************" print "* Rekursiv definierte Funktionen (s. Quellcode) *" print "* re(x,n) und sz(x,n) *" print "* Fourier-Reihen von Rechteck und Saegezahn bis zu sin(n*x)/n *" print "* Achtung: fuer Rechteck MUSS n U_N_gerade sein !!!! *" print "* Viel Spass damit ..... kr , Juni 2006 *" print "***************************************************************" # set title "Fourier - Reihe : Reckteck" set yrange [-1.1:1.1] plot sin(x), sin(3.*x)/3.,sin(5.*x)/5.,sin(7.*x)/7.,sin(9.*x)/9. pause -1 " Weiter mit Summe ..." plot sin(x), sin(3.*x)/3.,sin(5.*x)/5.,sin(7.*x)/7.,sin(9.*x)/9., re(x,9) pause -1 " Weiter mit Grundschwingung, n = 1" plot re(x,1) pause -1 " Weiter mit n= 1 , 3" plot re(x,3) pause -1 " Weiter mit n= 1 , 3 , 5" plot re(x,5) pause -1 " Weiter mit n= 1 , 3 , 5 , 7" plot re(x,7) pause -1 " Weiter mit n= 1 , 3 , 5 , .. 9" plot re(x,9) pause -1 " Weiter mit n= 1 , 3 , 5 , .. 15" plot re(x,15) pause -1 " Weiter mit n= 1 , 3 , 5 , .. 31" plot re(x,31) pause -1 " Weiter mit n= 1 , 3 , 5 , .. 63" plot re(x,63) # pause -1 " Weiter mit Saegezahn" set title "Fourier - Reihe : Saegezahn" set yrange [-2:2] plot sin(x), sin(2.*x)/2.,sin(3.*x)/3.,sin(4.*x)/4.,sin(5*x)/5. pause -1 " Weiter mit Summe ..." plot sin(x), sin(2.*x)/2.,sin(3.*x)/3.,sin(4.*x)/4.,sin(5*x)/5., sz(x,5) pause -1 " Weiter mit Saegezahn, Grundschwingung, n = 1" plot sz(x,0) pause -1 " Weiter mit n= 1 , 2" plot sz(x,2) pause -1 " Weiter mit n= 1 , 2 , 3" plot sz(x,3) pause -1 " Weiter mit n= 1 , 2, 3, 4" plot sz(x,4) pause -1 " Weiter mit n= 1 , 2 , ..5" plot sz(x,5) pause -1 " Weiter mit n= 1 , 2 , .. 8" plot sz(x,8) pause -1 " Weiter mit n= 1 , 2 , .. 16" plot sz(x,16) pause -1 " Weiter mit n= 1 , 2 , .. 32" plot sz(x,32) pause -1 " Weiter mit n= 1 , 2 , .. 64" plot sz(x,64)