Cody

Problem 45779. Variance computation (★★★)

Solution 2650181

Submitted on 3 Jul 2020 by Asif Newaz
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
x = [-1, 3, 5, -4, 10, 12]; y_correct = 38.16666666666667; assert(isequal(your_fcn_name(x),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'std')),'std forbidden') assert(isempty(strfind(filetext, 'var')),'var forbidden') assert(isempty(strfind(filetext, 'mean')),'var forbidden')

y = 38.1667

2   Pass
x = 1:10; y_correct = 9.166666666666666; assert(isequal(your_fcn_name(x),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'std')),'std forbidden') assert(isempty(strfind(filetext, 'var')),'var forbidden') assert(isempty(strfind(filetext, 'mean')),'var forbidden')

y = 9.1667

3   Pass
x = primes(30); y_correct = 81.43333333333334; assert(isequal(your_fcn_name(x),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, 'std')),'std forbidden') assert(isempty(strfind(filetext, 'var')),'var forbidden') assert(isempty(strfind(filetext, 'mean')),'var forbidden')

y = 81.4333

Suggested Problems

More from this Author46

Community Treasure Hunt

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

Start Hunting!