Variance computation (★★★) - MATLAB Cody - MATLAB Central

Problem 45779. Variance computation (★★★)

Difficulty:Rate
Given a vector x with several values, compute the variance, whose formula is given by:
where x1, x2, ...., xn are the n elements of the vector x, and μ is the average of the vector x.
For example, if
x = [-1, 3, 5, -4, 10, 12]
Then μ=4.16667 the variance is 38.16667. The following commands are forbidden: std, var, mean, for, while.

Solution Stats

30.3% Correct | 69.7% Incorrect
Last Solution submitted on Jan 18, 2025

Problem Comments

Solution Comments

Show comments
Who Deserves Your Praise? Discover the New Contribution Widget!
...
We are excited to announce another update to our Discussions area: the...

Problem Recent Solvers34

Suggested Problems

More from this Author52

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page