工程与科学数值方法的Matlab实现

%stats.m

function [mean,stdev]=stats(x)
n=length(x);
mean=sum(x)/n;
stdev=sqrt(sum((x-mean).^2/(n-1)));

// command window

>>y=[8 5 10 12 6 7.5 4];
>> [m,s]=stats(y)

//多值反回

原文地址:https://www.cnblogs.com/fooxer/p/3619175.html