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 172776

Submitted on 5 Dec 2012 by @bmtran

Correct

47Size
Leading solution size is 40.
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 = [4 6 7; 0 2 3; 2, -3, 6];
b = [-3; 8; 5];
Ab = [A,b];
Ab(end,:)=[0, -6, 5/2, 13/2];
assert(isequal(ForwardEliminate([A,b],1),Ab))

                    
2
Pass
 
%%
A = [4 6 7; 0 2 3; 2, -3, 6];
b = [-3; 8; 5];
Ab = [A,b];
Ab(end,:)=[0, -6, 5/2, 13/2];
Ab2 = Ab;
Ab2(3,:) = Ab(3,:) + 3*Ab(2,:);
assert(isequal(ForwardEliminate(Ab,2),Ab2))