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

New to MATLAB?

Solution 234231

Submitted on 23 Apr 2013

Incorrect

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

This solution is outdated. To rescore this solution, log in.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
user_solution = fileread('hypercube_edges.m');
assert(isempty(strfind(user_solution,'regexp')));
assert(isempty(strfind(user_solution,'2str')));
assert(isempty(strfind(user_solution,'str2')));
assert(isempty(strfind(user_solution,'interp')));
Error: Assertion failed.

	    	
2
Pass
 
%%
n = 0;
E_correct = 0;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
     0

	    	
3
Pass
 
%%
n = 1;
E_correct = 1;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
     1

	    	
4
Pass
 
%%
n = 2;
E_correct = 4;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
     4

	    	
5
Pass
 
%%
n = 3;
E_correct = 12;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
    12

	    	
6
Pass
 
%%
n = 4;
E_correct = 32;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
    32

	    	
7
Pass
 
%%
n = 5;
E_correct = 80;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
    80

	    	
8
Pass
 
%%
n = 6;
E_correct = 192;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
   192

	    	
9
Pass
 
%%
n = 7;
E_correct = 448;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
   448

	    	
10
Pass
 
%%
n = 8;
E_correct = 1024;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
        1024

	    	
11
Pass
 
%%
n = 9;
E_correct = 2304;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
        2304

	    	
12
Pass
 
%%
n = 10;
E_correct = 5120;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
        5120

	    	
13
Pass
 
%%
n = 11;
E_correct = 11264;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
       11264

	    	
14
Pass
 
%%
n = 12;
E_correct = 24576;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
       24576

	    	
15
Pass
 
%%
n = 13;
E_correct = 53248;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
       53248

	    	
16
Pass
 
%%
n = 14;
E_correct = 114688;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
      114688

	    	
17
Pass
 
%%
n = 15;
E_correct = 245760;
assert(isequal(hypercube_edges(n),E_correct))
ans =
  Columns 1 through 8
           0           1           4          12          32          80         192         448
  Columns 9 through 16
        1024        2304        5120       11264       24576       53248      114688      245760
ans =
      245760