Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Torsten
Posts:
1,639
Registered:
11/8/10


Re: Standard deviation
Posted:
Jan 28, 2013 9:50 AM


"Paul " <paulrockt@gmx.de> wrote in message <ke61o4$4n8$1@newscl01ah.mathworks.com>... > Hi together, > i calculate the standard deviaton in MATLAB and to the check the results i reculculated manually in MATLAB and Excel and i got different results. I split the formula in MATLAB to calculate the individual terms and as result i have received the same as in Excel. Is there a known problem with the standard deviation in MATLAB? > > My example: > > test = 18.2264 17.7185 15.4258 15.4092 > > mean_test = 16.6950 <<< mean_test= mean(test) > > sqr = 278.7222 <<< sqr= mean_test^2 > > test_sqr = 332.2018 313.9459 237.9556 237.4423 <<< test_sqr= test.^2 > > diff = 53.4796 35.2237 40.7666 41.2799 <<< diff = bsxfun(@minus,test_sqr,sqr) > > sum = 6.6568 <<< summe = sum(diff(:)) > > norm = 1.6642 <<< norm = 0.25*summe > > final = 1.2900 <<< final = norm^0.5 > > my results > > in Excel: 1.2901 > in MATLAB (manually): 1.2900 > in MATLAB (with "stdev"): 1.0931 > > Can someone explain this to me? > > Thanks,Paul
1. I only know of the command "std" in MATLAB. 2. Usually, the above variable "norm" is calculated according to norm=1/3*summe.
Instead of the stepwise calculation from above, provide your MATLAB code  it's easier to follow.
Best wishes Torsten.



