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 320538

Submitted on 18 Sep 2013 by @bmtran

Correct

45Size
Leading solution size is 15.
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 = 1;
b = 2;
c = 3;
n = 5;
y_correct = [ 2     3     0     0     0;
              1     2     3     0     0;
              0     1     2     3     0;
              0     0     1     2     3;
              0     0     0     1     2];
assert(isequal(tridiag(a, b, c, n),y_correct))

                    
2
Pass
 
%%
a = 9;
b = 5;
c = -17;
n = 3;
y_correct = [ 5   -17     0 ;
              9     5   -17 ;
              0     9     5 ];
assert(isequal(tridiag(a, b, c, n),y_correct))