Cody

Solution 1993607

Submitted on 28 Oct 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.')

zscore = 0.5421 0.5160 0.4989 0.6729 0.6729 0.4937 0.5015 0.4880 0.5185 0.4704

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.')

zscore = 0.6111 0.6111 0.5447 0.5048 0.4942 0.5449 0.5643 0.4452 0.5198 0.5210

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

Suggested Problems

More from this Author1