function [D1,H] = d1_noneq_6(N,h)

% N: Number of grid points
if(N<12)
    error('Operator requires at least 12 grid points');
end

% BP: Number of boundary points
BP = 6;

%%%% Norm matrix %%%%%%%%
P = sparse(BP,1);
%#ok<*NASGU>
P0 =  1.3030223027124e-01;
P1 =  6.8851501587715e-01;
P2 =  9.5166202564389e-01;
P3 =  9.9103890475697e-01;
P4 =  1.0028757074552e+00;
P5 =  9.9950151111941e-01;

for i = 0:BP-1
    P(i+1) = eval(['P' num2str(i)]);
end

H = ones(N,1);
H(1:BP) = P;
H(end-BP+1:end) = flip(P);
H = spdiags(h*H,0,N,N);
%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% Q matrix %%%%%%%%%%%
% interior stencil
order = 6;
d = [-1/60,3/20,-3/4,0,3/4,-3/20,1/60];
d = repmat(d,N,1);
Q = spdiags(d,-order/2:order/2,N,N);

% Boundaries
Q0_0 = -5.0000000000000e-01;
Q0_1 =  6.6042071945824e-01;
Q0_2 = -2.2104152954203e-01;
Q0_3 =  7.6243679810093e-02;
Q0_4 = -1.7298206716724e-02;
Q0_5 =  1.6753369904210e-03;
Q0_6 =  0.0000000000000e+00;
Q0_7 =  0.0000000000000e+00;
Q0_8 =  0.0000000000000e+00;
Q1_0 = -6.6042071945824e-01;
Q1_1 =  0.0000000000000e+00;
Q1_2 =  8.7352798702787e-01;
Q1_3 = -2.6581719253084e-01;
Q1_4 =  5.7458484948314e-02;
Q1_5 = -4.7485599871040e-03;
Q1_6 =  0.0000000000000e+00;
Q1_7 =  0.0000000000000e+00;
Q1_8 =  0.0000000000000e+00;
Q2_0 =  2.2104152954203e-01;
Q2_1 = -8.7352798702787e-01;
Q2_2 =  0.0000000000000e+00;
Q2_3 =  8.1707122038457e-01;
Q2_4 = -1.8881125503769e-01;
Q2_5 =  2.4226492138960e-02;
Q2_6 =  0.0000000000000e+00;
Q2_7 =  0.0000000000000e+00;
Q2_8 =  0.0000000000000e+00;
Q3_0 = -7.6243679810093e-02;
Q3_1 =  2.6581719253084e-01;
Q3_2 = -8.1707122038457e-01;
Q3_3 =  0.0000000000000e+00;
Q3_4 =  7.6798636652679e-01;
Q3_5 = -1.5715532552963e-01;
Q3_6 =  1.6666666666667e-02;
Q3_7 =  0.0000000000000e+00;
Q3_8 =  0.0000000000000e+00;
Q4_0 =  1.7298206716724e-02;
Q4_1 = -5.7458484948314e-02;
Q4_2 =  1.8881125503769e-01;
Q4_3 = -7.6798636652679e-01;
Q4_4 =  0.0000000000000e+00;
Q4_5 =  7.5266872305402e-01;
Q4_6 = -1.5000000000000e-01;
Q4_7 =  1.6666666666667e-02;
Q4_8 =  0.0000000000000e+00;
Q5_0 = -1.6753369904210e-03;
Q5_1 =  4.7485599871040e-03;
Q5_2 = -2.4226492138960e-02;
Q5_3 =  1.5715532552963e-01;
Q5_4 = -7.5266872305402e-01;
Q5_5 =  0.0000000000000e+00;
Q5_6 =  7.5000000000000e-01;
Q5_7 = -1.5000000000000e-01;
Q5_8 =  1.6666666666667e-02;
for i = 1:BP
    for j = 1:BP
        Q(i,j) = eval(['Q' num2str(i-1) '_' num2str(j-1)]);
        Q(N+1-i,N+1-j) = -eval(['Q' num2str(i-1) '_' num2str(j-1)]);
    end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%% Difference operator %%
D1 = H\Q;
%%%%%%%%%%%%%%%%%%%%%%%%%%%