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 197490

Submitted on 28 Jan 2013 by Alfonso Nieto-Castanon

Correct

27Size
Leading solution size is 22.
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=[2     3     7; 0     5     8; 0     0     9];
b=[12; 13; 9];
y_correct = [1; 1; 1];
assert(isequal(my_backsub(A,b),y_correct))

                    
2
Pass
 
%%
A=[2     3     7; 0     5     8; 1     0     9];
b=[12; 13; 9];
y_correct = [inf];
assert(isequal(my_backsub(A,b),y_correct))

                    
3
Pass
 
%%
A=[7.9200    9.5900    6.5600
         0    8.4900    9.3400
         0         0    7.4300];
b=[   66.3400
   48.4000
   52.0100];
y_correct = [5; -2; 7];
assert(isequal(my_backsub(A,b),y_correct))