Jump to content


Data Visualization

GNUPLOT 2d plot

  • Please log in to reply
4 replies to this topic

#1 geoalg



  • Moderators
  • LocationAmerica

Posted 19 July 2013 - 05:51 PM

GNUPLOT is a useful tool for producing 2d and 3d plots for your experimental data.




Documentation: http://gnuplot.sourc...umentation.html

Tutorial: http://people.duke.e...in/gnuplot.html


If you are using Debian/Ubuntu, make sure you install the gnuplot-x11 package; otherwise plots appear to get swallowed by stdout.


GNUPLOT will generate various output formats, including post script which is a useful format for image imports into the LaTex document preparation system.


To give you an idea of the type of 2d output GNUPLOT can produce, here is a plot from recent data acquired from my 1000kcps coil system (output in png format).



Here's an example of a gnuplot session:

gnuplot> set grid
gnuplot> set ytics 0.1
gnuplot> set xtics 5
gnuplot> set xlabel 'Frequency (kcps)'
gnuplot> set ylabel 'Io_normalized (uA/uA) relative to 50uA peak'
gnuplot> set title 'Secondary System response to 1500pF experimental capacitor, C=C_max=1638 nF'
gnuplot> plot "measurements2.dat" using 1:3 title 'Normalized Field Intensity Vs. Frequency for Secondary System, Grounded' with linespoints

with the datafile (measurements2.dat) listing as follows:

# This file is called measurements2.dat
# Experimental Setup:
# Grounded secondary Response, c-1636nF, scale set to 50uA peak
# 6sn7 Triode Driver
#Fo (kcps)    Io (uA)    Io_norm(uA)
1119    5    0.1
1129    10    0.2
1134    15    0.3
1136    20    0.4
1139    25    0.5
1142    30    0.6
1142    35    0.7
1144    40    0.8
1147    45    0.9
1149    50    1
1151    45    0.9
1153    40    0.8
1153    35    0.7
1155    30    0.6
1157    25    0.5
1160    20    0.4
1163    15    0.3
1167    10    0.2
1178    5    0.1


Which produces the following output:


  • 1

#2 geoalg



  • Moderators
  • LocationAmerica

Posted 21 July 2013 - 01:16 AM

Bewley lists a versatile function for the study of experimental wave forms on page 23 of "Traveling Waves on Transmission Systems."


[LaTeX Error: One or more directories do not exist]


where, in general, 'E', 'a' and 'b' are complex quantities.


The versatility of this function comes from the fact that the parameters can be modified to generate many functions such as infinite rectangular, ramps, impulses, sustained sinusoids, decaying sinusoids, and so on.


In Gnuplot, complex numbers of the form 'x1+ jx2' are represented with the following structure: {x1,x2}, 'x1' being the real quantity, and 'x2' the complex.


Here's a 2d plot of a particular damped sinusoid, with paramaters E=0.5j, a=0.1-10j, b=0.1+10j:

gnuplot> plot {0,0.5}*(exp(-{0.1,-10}*x)-exp(-{0.1,10}*x))


Here's a surface plot of the same function using splot :

gnuplot> splot {0,0.5}*(exp(-{0.1,-10}*x)-exp(-{0.1,10}*x))




With some parameter tweaks we get the impulse response:

gnuplot> plot {1,0}*(exp(-{0.5,0}*x)-exp(-{2,0}*x));






gnuplot> plot {0,0.5}*(exp(-{0.0,-10}*x)-exp(-{0,10}*x));



Convex rise:

gnuplot> set xrange [0.0:100]
gnuplot> plot {1,0.0}*(exp(-{0.0,0}*x)-exp(-{0.05,0}*x));



Exponential Decay:



More complicated waveforms can be synthesized through time shifting and/or superposition:


Decaying sinusoidal time shifted by five units with a Rectangular Pulse



Decaying sinusoidal combinded with a concave rising path


It's also possible to use the windowing property of the time shifted rectangular wave combined with another waveform (an inverted pulse for instance) to simulate reflected waves on a  transmission system.

  • 2

#3 Raui



  • Administrators

Posted 21 July 2013 - 09:50 AM

Thanks for sharing this! I have done a bit of work with matlab in this regard which works similar but I'll try out GNU plot. Nice demonstration of that handy equation too. I'll be sure to re-read the section with that equation in it. Last time I read Bewley was a while ago and at the time I found it pretty difficult but I should be in a better position to understand it now.

  • 0

#4 geoalg



  • Moderators
  • LocationAmerica

Posted 22 July 2013 - 07:27 PM

If you like Matlab, you may want to take a look at Octave for your Linux system.


I may have to put the Bewley information into it's own topic. It's fun to just play with the expressions in the software to get a feel,  but to really study it requires a little more analytical work.

Maybe it would be best to just tool up a little bit with some basics, get onto some circuitry to drive the coil system for measurements, and then model the data with these types of expressions that allow you to pick off the various oscillation and decay properties. I think these equations would be useful for electric machine study as well.

  • 0

#5 Raui



  • Administrators

Posted 23 July 2013 - 12:31 AM

I've had octave for a while already. Haven't used it much though but it is very similar to matlab.


Yeah Bewley is a topic unto himself, just about all the books Eric referenced are. Sounds like a good idea regarding modelling using the above equation.

  • 0

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users