From 255299f5ff9af37680659b3d362c88193b987d96 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Thu, 5 Sep 2013 13:40:54 -0400 Subject: added part about statistics, small fixes --- matlab_usage_source/index.t2t | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/matlab_usage_source/index.t2t b/matlab_usage_source/index.t2t index a8c14d4..d09131e 100644 --- a/matlab_usage_source/index.t2t +++ b/matlab_usage_source/index.t2t @@ -13,7 +13,7 @@ you need to process multiple data point it became tedious with a simple calculator. Once you master Matlab it will not matter if it is one data point or millions of them. It can do complex math, plotting, fitting, etc. It is also the complete programming language which can stand by itself. -Also, Matlab has excellent help documentation and a lot of tutorials at the web. +Also, Matlab has **excellent help documentation** and a lot of tutorials at the web. There are free alternatives. [Octave http://www.gnu.org/software/octave/] is one example. This what I personally use @@ -30,10 +30,42 @@ Since we are learning Matlab, we will not have time to go to fancy toolboxes which Matlab provides/removes with new releases. += Statistics functions = + +== Mean of a set == +Often you will need to find the mean and standard deviation of a particular +sample set. Let's say we estimated a resistor value (**R**) with different +method and obtained the following experimental values. + +| **R** | 1.20 | 1.10 | 1.11 | 1.05 | 1.05 | 1.15 | + +First we transfer it to a Matlab vector variable +``` R=[ 1.20, 1.10, 1.11, 1.05, 1.05, 1.15 ] + +Notice that for a vector variable I use **,** as a separator. + +Now we ready to calculate mean of this set +``` mean(R) +with answer 1.1100 + +== Standard deviation of a set == +Standard deviation normalized with **N-1** samples (so called unbiased estimator) +is done with +``` std(R) +with answer 0.058310. If you need normalization with **N** samples do +``` std(R,1) +with answer 0.053229 + +In both cases there is to many significant figures which is unjustified +from physics point of view. So remember, Matlab just does the math for you, +the analysis and presentation of results is on you. + + + = How to make a simple plot = Suppose during the measurements we obtain the following data -for each current value 'I' we measured voltage 'V' -with some uncertainty in voltage measurement dV. +for each current value **I** we measured voltage **V** +with some uncertainty in voltage measurement **dV**. Our experimental data is represented in the following table. || I | V | dV | @@ -43,7 +75,7 @@ Our experimental data is represented in the following table. | 3.3 | 3.8 | 0.2 | | 4.0 | 4.9 | 0.3 | -First of all, we need to transfer it to the Matlab vector variables. Pay +First of all, we need to transfer it to the Matlab column vector variables. Pay attention to the delimiter **;** between numbers ``` -- cgit v1.2.3