I made this script for the standard deviation last year, don't remember how it works but mess around a bit and compare it to the real 'std' function.
function [ y ] = myStd( x, prob )
if prob == 0
y = sqrt(sum((x-mean(x)).^2)/length(x));
else
(prob.*x.^2)/sum(prob)
y = sqrt(mean(x)^2);
end
end
The mean is really easy to build and should be something like this
y= 1/sizeof(x) * sum(x);
I'll check if I have any other of these functions on my computer.