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 58502

Submitted on 9 Mar 2012 by David Young

Correct

98Size
Leading solution size is 35.
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 = [0.3147 -0.4025 -0.3424 -0.3581  0.1557  0.2577  0.2060;...
     0.4058 -0.2215  0.4706 -0.0782 -0.4643  0.2431 -0.4682;...
    -0.3730  0.0469  0.4572  0.4157  0.3491 -0.1078 -0.2231;...
     0.4134  0.4575 -0.0146  0.2922  0.4340  0.1555 -0.4538;...
     0.1324  0.4649  0.3003  0.4595  0.1787 -0.3288 -0.4029];
n = 2;
y_correct = [1     0     0     0     2     3     3;...
             3     2     4     2     0     2     0;...
             0     2     3     3     3     1     3;...
             4     2     0     1     4     3     1;...
             1     3     2     3     0     0     2];
assert(isequal(your_fcn_name(A,n),y_correct))

                    
2
Pass
 
%%
A = [0.3235    0.4502   -0.1184   -0.3131;...
     0.1948   -0.4656    0.2655   -0.0102;...
    -0.1829   -0.0613    0.2952   -0.0544];
n = 3;
y_correct = [5     5     0     0;...
             2     0     2     4;...
             0     2     5     3];
assert(isequal(your_fcn_name(A,n),y_correct))

                    
3
Pass
 
%%
A = ones(3,10);
n = 3;
y_correct = zeros(3,10);
assert(isequal(your_fcn_name(A,n),y_correct))