Cody

Solution 580921

Submitted on 12 Feb 2015 by James
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% % test for correct size for iter = 1:10 vectorLength = randi([1 100]); result = fcn(vectorLength); assert(isequal([vectorLength, 1], size(result))); end

2   Pass
%% % get large sample vectorLength = 10000; result = fcn(vectorLength); % build empirical cumulative distribution function xEmpirical = sort(result); % x-axis yEmpirical = (1:vectorLength).' ./ vectorLength; % y-axis % build theoretical cumulative distribution function xTheoretical = xEmpirical; % x-axis yTheoretical = 0.5*xTheoretical; % y-axis % compute statistics on diff between empirical and theoretical errorList = abs(yEmpirical - yTheoretical); errorMax = max(errorList); errorMean = mean(errorList); errorStd = std(errorList); % if fcn is correct, this should pass at least 99.9% of the time assert(errorMax < .02); assert(errorMean < .012); assert(errorMean > .0008); assert(errorStd > .0007);

Suggested Problems

More from this Author2