Cody

# Problem 44447. Eye Squared

Solution 1522781

Submitted on 8 May 2018 by OZ FEDERMAN
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('eyeSquared.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

2   Pass
n = 0; I_correct = []; assert(isequal(eyeSquared(n),I_correct))

a = 0 x = 0 I = []

3   Pass
n = 1; I_correct = 1; assert(isequal(eyeSquared(n),I_correct))

a = 1 x = 1 I = 1

4   Pass
n = 4; I_correct = [1 0; 0 1]; assert(isequal(eyeSquared(n),I_correct))

a = 2 x = 2 I = 1 0 0 1

5   Pass
n = 9; I_correct = [1 0 0; 0 1 0; 0 0 1]; assert(isequal(eyeSquared(n),I_correct))

a = 3 x = 3 I = 1 0 0 0 1 0 0 0 1

6   Pass
n = -9; I_correct = []; assert(isequal(eyeSquared(n),I_correct))

a = 0.0000 + 3.0000i x = 0.0000 + 3.0000i I = []

7   Pass
n = 10; I_correct = []; assert(isequal(eyeSquared(n),I_correct))

a = 3.1623 x = 3 I = []

8   Pass
n = 4.1; I_correct = []; assert(isequal(eyeSquared(n),I_correct))

a = 2.0248 x = 2 I = []

### Community Treasure Hunt

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

Start Hunting!