Cody

Solution 1944622

Submitted on 21 Sep 2019 by Augusto Mazzei
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
filetext = fileread('matrixManipulation.m'); assert(isempty(strfind(filetext, 'system')))

2   Pass
x = 1; y_correct = ones(2); assert(isequal(matrixManipulation(x),y_correct))

y = 1 1 1 1

3   Pass
x = 2; y_correct = [1 1/2; 2 1]; assert(isequal(matrixManipulation(x),y_correct))

y = 1.0000 0.5000 2.0000 1.0000

4   Pass
x = 2:4; y_correct = [1 1/2 1/3; 2 1 1/4; 3 4 1]; assert(isequal(matrixManipulation(x),y_correct))

y = 1.0000 0.5000 0.3333 2.0000 1.0000 0.2500 3.0000 4.0000 1.0000

5   Pass
x = 2:7; y_correct = [1 1/2 1/3 1/4; 2 1 1/5 1/6; 3 5 1 1/7; 4 6 7 1]; assert(isequal(matrixManipulation(x),y_correct))

y = 1.0000 0.5000 0.3333 0.2500 2.0000 1.0000 0.2000 0.1667 3.0000 5.0000 1.0000 0.1429 4.0000 6.0000 7.0000 1.0000