Cody

Solution 2049087

Submitted on 6 Dec 2019
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   Fail
m = 100; n = 10; x = rand(m,n); k = false(1,n); k(randi(n,1,3)) = true; x(:,k) = rand; tol = 1.0e-12; out = zscore(x); assert(isstruct(out),'Struct test failed.') assert(isfield(out,'Z'),'Z field test failed.') assert(isfield(out,'Mu'),'Mu field test failed.') assert(isfield(out,'Sigma'),'Sigma field test failed.') assert(isequal(size(x),size(out.Z)),'Z size test failed.') assert(isequal(size(x(1,:)),size(out.Mu)),'Mu size test failed.') assert(isequal(size(x(1,:)),size(out.Sigma)),'Sigma size test failed.') assert(all(abs(mean(out.Z))<tol),'Mean test failed.') assert(all(abs(std(out.Z(:,~k))-1)<tol),'STD test failed.') assert(all(abs(std(out.Z(:,k)))<tol),'STD test for invariant data failed.') assert(isequal(out.Mu,mean(x,1)),'Mean equality test failed.') assert(isequal(out.Sigma,std(x,0,1)),'STD equality test failed.')

Output argument "out" (and maybe others) not assigned during call to "zscore". Error in Test1 (line 8) out = zscore(x);

2   Fail
m = 100; n = 10; rng(2000,'twister') x = rand(m,n); k = false(1,n); k(randi(n,1,3)) = true; x(:,k) = rand; tol = 1.0e-12; out = zscore(x); assert(isstruct(out),'Struct test failed.') assert(isfield(out,'Z'),'Z field test failed.') assert(isfield(out,'Mu'),'Mu field test failed.') assert(isfield(out,'Sigma'),'Sigma field test failed.') assert(isequal(size(x),size(out.Z)),'Z size test failed.') assert(isequal(size(x(1,:)),size(out.Mu)),'Mu size test failed.') assert(isequal(size(x(1,:)),size(out.Sigma)),'Sigma size test failed.') assert(all(abs(mean(out.Z))<tol),'Mean test failed.') assert(all(abs(std(out.Z(:,~k))-1)<tol),'STD test failed.') assert(all(abs(std(out.Z(:,k)))<tol),'STD test for invariant data failed.') assert(isequal(out.Mu,mean(x,1)),'Mean equality test failed.') assert(isequal(out.Sigma,std(x,0,1)),'STD equality test failed.')

Output argument "out" (and maybe others) not assigned during call to "zscore". Error in Test2 (line 9) out = zscore(x);