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 238529

Submitted on 1 May 2013 by Clemens Giegerich

Correct

24Size
Leading solution size is 20.
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
 
user_solution = fileread('simplexvolume.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')));
assert(isempty(strfind(user_solution,'printf')));
assert(isempty(strfind(user_solution,'assert')));

                    
2
Pass
 
%%
n = 0;
V_correct = 1.0;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
3
Pass
 
%%
n = 1;
V_correct = 1.0;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
4
Pass
 
%%
n = 2;
V_correct = 0.433012701892219;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
5
Pass
 
%%
n = 3;
V_correct = 0.117851130197758;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
6
Pass
 
%%
n = 4;
V_correct = 0.023292374765623;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
7
Pass
 
%%
n = 5;
V_correct = 0.003608439182435;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
8
Pass
 
%%
n = 6;
V_correct = 0.000459331824838;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
9
Pass
 
%%
n = 7;
V_correct = 0.000049603174603;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
10
Pass
 
%%
n = 8;
V_correct = 0.000004650297619;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
11
Pass
 
%%
n = 9;
V_correct = 0.000000385125244;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
12
Pass
 
%%
n = 10;
V_correct = 0.000000028561653;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
13
Pass
 
%%
n = 11;
V_correct = 0.000000001917653;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
14
Pass
 
%%
n = 12;
V_correct = 0.000000000117613;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
15
Pass
 
%%
n = 13;
V_correct = 0.000000000006639;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
16
Pass
 
%%
n = 14;
V_correct = 0.000000000000347;
assert(abs(simplexvolume(n)-V_correct)<4*eps)

                    
17
Pass
 
%%
n = 15;
V_correct = 0.000000000000017;
assert(abs(simplexvolume(n)-V_correct)<4*eps)