You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mesh2d1.m
    path of file: ./repos/SuiteSparse/CXSparse/MATLAB/Demo/private
    
    the code of the file until where you have to start completion: function A = mesh2d1 (n)
% create an n-by-n 2D mesh for the 2nd difference operator
% Example:
%   A = mesh2d1 (30) ;  % a 30-by-30 mesh

    
function A = mesh2d1 (n)
% create an n-by-n 2D mesh for the 2nd difference operator
% Example:
%   A = mesh2d1 (30) ;  % a 30-by-30 mesh
% See also: cs_demo

% CXSparse, Copyright (c) 2006-2022, Timothy A. Davis. All Rights Reserved.
% SPDX-License-Identifier: LGPL-2.1+

ii = zeros (5*n^2, 1) ;     % preallocate ii, jj, and xx
jj = zeros (5*n^2, 1) ;
xx = zeros (5*n^2, 1) ;
k = 1 ;
for j = 0:n-1
    for i = 0:n-1
        s = j*n+i + 1 ;
        ii (k:k+4) = [(j-1)*n+i j*n+(i-1) j*n+i j*n+(i+1) (j+1)*n+i ] + 1 ;
        jj (k:k+4) = [s s s s s] ;
        xx (k:k+4) = [-1 -1 4 -1 -1] ;
        k = k + 5 ;
    end