% eda04_06
% data kernels for weigthed average case

N = 32;

M=N; % G is square

% assume averaging is symmetric with weights, w
% where first element of w is central weight

w = [2, 1]';  % three point weighted average

Lw = length(w);

% normalization, to ensure row sums are unity
n = 2*sum(w)-w(1);
w = w/n;

% construct matrix G
r = zeros(M,1);
c = zeros(N,1);
r(1:Lw)=w;
c(1:Lw)=w;
G = toeplitz(c,r);

w = [3, 2, 1]'; % five point weighted average

Lw = length(w);

% normalization, to ensure row sums are unity
n = 2*sum(w)-w(1);
w = w/n;

% construct matrix G2
r = zeros(M,1);
c = zeros(N,1);
r(1:Lw)=w;
c(1:Lw)=w;
G2 = toeplitz(c,r);

w = [5, 4, 3, 2, 1]'; % three point weighted average

Lw = length(w);

% normalization, to ensure row sums are unity
n = 2*sum(w)-w(1);
w = w/n;

% construct matrix G3
r = zeros(M,1);
c = zeros(N,1);
r(1:Lw)=w;
c(1:Lw)=w;
G3 = toeplitz(c,r);

eda_draw(' ',G,'caption G-3',' ',G2,'caption G-5',' ',G3,'caption G-7');