%% Sparse Matrix of Nonzeros with Specified Size
% Create a 1500-by-1500 sparse matrix from the triplets i, j, and v.

i = [900 1000];
j = [900 1000];
v = [10 100];
S = sparse(i,j,v,1500,1500)

%
% When you specify a size larger than max(i) -by- max(j), the sparse function pads the output with extra rows and columns of zeros.

size(S)

% Copyright 2015 The MathWorks, Inc.