diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-04 13:33:45 -0400 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2013-09-04 13:41:47 -0400 |
commit | 173585cba1a270632405ee372d631ff4b5d0aaf8 (patch) | |
tree | fabe6f16f31cbfe5ed17d8f0d4c8ab03692badb6 /matlab_usage_source/index.t2t | |
parent | 588e91859f468ea6fbfdc846a9146dcffcfecedc (diff) | |
download | manual_for_Experimental_Atomic_Physics-173585cba1a270632405ee372d631ff4b5d0aaf8.tar.gz manual_for_Experimental_Atomic_Physics-173585cba1a270632405ee372d631ff4b5d0aaf8.zip |
added simple matlab plotting example
Diffstat (limited to 'matlab_usage_source/index.t2t')
-rw-r--r-- | matlab_usage_source/index.t2t | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/matlab_usage_source/index.t2t b/matlab_usage_source/index.t2t new file mode 100644 index 0000000..5038cba --- /dev/null +++ b/matlab_usage_source/index.t2t @@ -0,0 +1,66 @@ +Matlab usage + + + +%!style(html): ../evmik.css + + += How to make a simple plot = +Suppose during the measurements we obtain the following data +fir each parameter 'I' we measured 'V' with a particular uncertainty dV. +Our data is represented in the following table. + +|| I | V | dV | +| .1 | 1.0 | 0.2 | +| 1.0 | 2.2 | 0.1 | +| 1.8 | 3.2 | 0.2 | +| 3.3 | 3.8 | 0.2 | +| 4.0 | 4.9 | 0.3 | + +First we need to transfer it to the Matlab vector variables. Pay attention to the +delimiter **;** between numbers + +``` I = [ .1; 1.0; 1.8; 3.3; 4.0 ] +``` V = [ 1.0; 2.2; 3.2; 3.8; 4.9 ] +``` dV = [ 0.2; 0.1; 0.2; 0.2; 0.3 ] + +First we make a plot without error bars just to get the basic, text after +**%** is considered as a comment and matlab will disregard it. + +``` figure(1) % all plotting output will go to the particular window +``` plot(I,V) + +Easy, is not it? + +[simple_labeled_plot.png] + + +But **every plot** must be present with title, proper axes labels and +units. Note **'** for the string specifiers + +``` title('Dependence of voltage on current') +``` xlabel('Voltage (V)') +``` ylabel('Current (A)') + +No our plot is nice and pretty. + +[simple_unlabeled_plot.png] + += Plotting with error bars = +Let's open a new window for the plot + +``` figure(2) + +Now we make plot with error bars assuming that they are the same for up and down parts + +```errorbar(I,V,dV) + +Yet again we need proper labeling + +``` title('Dependence of voltage on current') +``` xlabel('Voltage (V)') +``` ylabel('Current (A)') + +[errorbar_plot.png] + + |