% eda06_02
% plot columns of G
% (not normalized - see eda06_13 for properly normalized version)

N=32;
M=N;

% set up time
Dt=1;
tmin=0.0;
tmax = tmin+Dt*(N-1);
t = tmin + Dt*[0:N-1]';

% nyquist frequencies
Nf=N/2+1;
fmax = 1/(2*Dt);
Df = fmax/(N/2);
f = Df*[0:Nf-1]';
Nw=Nf;
wmax = 2*pi*fmax;
Dw = wmax/(N/2);
w = Dw*[0:Nw-1]';

% set up G
G=zeros(N,M);

% zero frequency column
G(:,1)=1;

% interior M/2-1 columns
for i = [1:M/2-1]
    j = 2*i;
    k = j+1;
    G(:,j)=cos(w(i+1).*t);
    G(:,k)=sin(w(i+1).*t);
end

% nyquist column
G(:,M)=cos(w(Nw).*t);
    

% plot spectral density
figure(1)
clf;

% plot columns of G vs time

j=1;
for i = [1:5,M]
    subplot(1,6,j);
    j=j+1;
    set(gca,'LineWidth',2);
    hold on;
    set(gca,'XAxisLocation','top');
    axis( [-2, 2, tmin, tmax] );
    axis ij;
    plot( G(:,i), t, 'k-','LineWidth',2);
    plot( G(:,i), t, 'k.','LineWidth',2);
    xlabel(sprintf('col %d',i));
    if (i==1) 
    ylabel('time, s');    
    end
end


