A vector version of this image (SVG) is available. For more information about vector graphics, read about Commons transition to SVG. Български | | | | | | | | Bahasa Indonesia | | | | | | | | | 中文(简体) | 中文(繁體) | +/- |
This shows several waveforms: sine wave, square wave, triangle wave, and rising sawtooth wave.
I think it's good to show them next to each other for context.
The fundamentals of each have the same frequency and phase.
See Wikipedia graph-making tips.
Generated in gnuplot with the following script (save as waveforms.plt and then open in gnuplot):
set samples 9001 set terminal postscript enhanced landscape color solid lw 2 "Times-Roman" 20 set output "waveforms.ps" # Define the four curves sine(x) = sin(x*pi) #(Originally was going to graph others as functions, but data files are easier and more accurate) # Set up a four-pane multiplot set size 1,1 set origin 1,0 set multiplot set grid # Set range of x axis set xrange [0:6] # Gridlines at every cycle set ytics 1 # Ticks distract from wave shapes set ticscale 0 # Show extents but don't waste space set yrange [-1.5:1.5] # No numbers needed; these are for shape comparison set format x "" set format y "" set nokey # Squish them together slightly # (Doesn't accept fractional margins???) set bmargin 1 set tmargin 0 # Plot each graph # I don't understand how the labels work in multiplot, but this gives the right output set size 1,0.25 set origin 0,0.75 set label 1 "Sine" at 5.5, 0.5 c plot sine(x) 1 set size 1,0.25 set origin 0,0.5 set label 1 "Square" at 5.5, 0.5 c plot "square.dat" with lines 2 set size 1,0.25 set origin 0,0.25 set label 1 "Triangle" at 5.5, 0.5 c plot "triangle.dat" with lines 3 set size 1,0.25 set origin 0,0 set label 1 "Sawtooth" at 5.5, 0.5 c plot "sawtooth.dat" with lines 4
and data files:
square.dat
# XY1 0 1 1 1 1 -1 2 -1 2 1 3 1 3 -1 4 -1 4 1 5 1 5 -1 6 -1
triangle.dat
# XY1 0 0 0.5 1 1.5 -1 2.5 1 3.5 -1 4.5 1 5.5 -1 6 0
sawtooth.dat
# XY1 0 0 1 1 1 -1 3 1 3 -1 5 1 5 -1 7 1
Then I opened the waveforms.ps file in a text editor to edit the line colors and linestyles, as per this description. This avoids needing to open in proprietary software, and really isn't that difficult (especially if you don't know the commands in the proprietary software either). ;-) Identify the lines easily by their color (the arrow is currently magenta and I want it to be black. Ah, there is the entry with 1 0 1, red + blue = magenta) or by using the gnuplot linestyle−1. (For instance, gnuplot's linestyle 3 corresponds to the ps file's /LT2.) Then you can edit the colors and dashes by hand.
I changed the original:
/LT1 { PL [4 dl 2 dl] 0 1 0 DL } def
into this:
/LT1 { PL [4 dl 2 dl] 0 0.7 0 DL } def
to make the green a little less neon.
To convert the PostScript file to PNG:
Created by User:Omegatron using gnuplot, possibly with post-processing in the GIMP (PNG) or Inkscape (SVG)
|
(In short, this means that you can copy and modify the image freely as long as you provide attribution; preferably in the form of a link back to this page.)
الصفحات التالية تحتوي على وصلة لهذه الصورة: