"Jos (10584)" wrote in message <ke62nu$958$1@newscl01ah.mathworks.com>...
> "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
>
> From the help of STD
> " STD normalizes Y by (N1), where N is the sample size. This is the
> sqrt of an unbiased estimator of the variance of the population from
> which X is drawn, as long as X consists of independent, identically
> distributed samples.
>
> Y = STD(X,1) normalizes by N and produces the square root of the second
> moment of the sample about its mean.
> "
> Indeed, for your example, std(test,1) gives 1.29 ...
>
> For more info see
> doc std
> and
> http://en.wikipedia.org/wiki/Standard_deviation
>
>
> hth
> ~ Jos
Hi Jos,
thank you, your answer helped me. My problem is solved!
