function [omega na a]=selectmatreal_trun(l)

% This function constructs AW matrix where the lowest L Fourier components
% are truncated. Note the truncation rule is specified in trun_rule.m file.

L=trun_rule(l);
if L>=l
    L=l-1;
end

w=zeros(l,l);
for t=1:l
 for s=1:l
   if t==1
      w(t,s)= l^(-1/2);
   elseif t==l && mod(l,2)==0
      w(t,s)= l^(-1/2)*(-1)^(s+1);
   elseif mod(t,2)==0 
      w(t,s)= (2/l)^(1/2)*cos(pi*t*(s-1)/l);
   else    
      w(t,s)= (2/l)^(1/2)*sin(pi*(t-1)*(s-1)/l);
   end
 end
end

a=eye(l);

if L>=1
for j=1:L
     a(j,j)=0;
end
end

omega=w'*a*w;
na=sum(diag(a));

