Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 214102

Submitted on 7 Mar 2013 by KrtX

Correct

36Size
Leading solution size is 10.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
A=magic(5);
y_correct = [
     4    11   -12    -5     2;
    10    -8    -6     1     3;
    -9    -7     0     7     9;
    -3    -1     6     8   -10;
    -2     5    12   -11    -4]
assert(isequal(your_fcn_name(A),y_correct))
y_correct =
     4    11   -12    -5     2
    10    -8    -6     1     3
    -9    -7     0     7     9
    -3    -1     6     8   -10
    -2     5    12   -11    -4
Result =
     4    24     1     8    15
    10     5     7    14    16
    -9     6    13    20    22
    -3    12    19    21     3
    -2    18    25     2     9
Result =
     4    11     1     8    15
    10    -8     7    14    16
    -9    -7    13    20    22
    -3    -1    19    21     3
    -2     5    25     2     9
Result =
     4    11   -12     8    15
    10    -8    -6    14    16
    -9    -7     0    20    22
    -3    -1     6    21     3
    -2     5    12     2     9
Result =
     4    11   -12    -5    15
    10    -8    -6     1    16
    -9    -7     0     7    22
    -3    -1     6     8     3
    -2     5    12   -11     9
Result =
     4    11   -12    -5     2
    10    -8    -6     1     3
    -9    -7     0     7     9
    -3    -1     6     8   -10
    -2     5    12   -11    -4
2
Pass
 
%%
A=magic(3);
y_correct = [
     3    -4     1;
    -2     0     2;
    -1     4    -3]
assert(isequal(your_fcn_name(A),y_correct))
y_correct =
     3    -4     1
    -2     0     2
    -1     4    -3
Result =
     3     1     6
    -2     5     7
    -1     9     2
Result =
     3    -4     6
    -2     0     7
    -1     4     2
Result =
     3    -4     1
    -2     0     2
    -1     4    -3