How can I write this formula in Matlab?
Show older comments
How can I write this formula in Matlab? Σ ( Xi - X )2 / N
Thanks
2 Comments
Geoff Hayes
on 28 Mar 2016
Omim - this seems like homework where you are expected to determine the variance of N equally likely values. Is this the case? What have you tried so far?
Omim
on 28 Mar 2016
Answers (2)
Azzi Abdelmalek
on 28 Mar 2016
xi=2
x=[1 2 3]
N=3
out=sum((xi-x).^2)/N
Star Strider
on 28 Mar 2016
You might be calculating the variance if ‘X’ is actually the mean of your vector. In that instance, the code would be:
VarX = var(X,1);
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!