Here is one way to implement your example in MATLAB:
function_output = zeros(numel(x), number_of_lines); % Initialize a 2-D array
for n = 1:number_of_lines % MATLAB uses 1-based indexing
function_output(:, n) = sin(n + x).'; %' Compute a row vector, transpose
% it into a column vector, and
% place the data in a column of
% the 2-D array
end
plot(x, function_output); % This will plot one line per column of the array
And here are some documentation links that you should read to find out and understand the code above: