function class26()
%CLASS02  Displays plots for ECE 3500 class
%   CLASS02()  creates all the plots for class lecture notes through the
%   use of Dr. Harley's plotforclass MATLAB function. To get the full
%   results from the lecture notes, this function requires the "export_fig"
%   and "oaxes" functions from the MathWorks File Exchange. 
%
%   INPUTS: none
%
%   OUTPUTS: none
%
%   see also: plot, stem, subplot, figure

close all;

addpath(genpath('../matlab/'))
namebase = ['./'];

n = 1;


%%
% ----------------------------------------------------------------------
% TYPES OF SIGNALS
% ----------------------------------------------------------------------

% Ideal Filter **********
fnc{n} = @plot; x{n} = -1:0.001:1;  y{n} = (x{n} > -0.5) - (x{n} > 0.5); 
xlbl{n} = '\omega'; ylbl{n} = 'H(\omega)'; xTickSuffix{n} = '\pi';
caption{n} = 'Ideal filter (real part, the imaginary part if zero)';
n = n + 1;

fnc{n} = @stem; x{n} = -10:10;  y{n} = sin(0.5*pi*x{n})./(pi*x{n}); y{n}(x{n}==0) = 0.5;
xlbl{n} = 'n'; ylbl{n} = 'h[n]'; 
caption{n} = 'Ideal filter impulse response (cropped in time)';
n = n + 1;

% Stability **********
fnc{n} = @stem; x{n} = -5:10;  y{n} = (0.5).^(x{n}).*(x{n} >= 0); 
xlbl{n} = 'n'; ylbl{n} = 'h[n]'; 
caption{n} = 'Desirable, stable impulse response';
n = n + 1;

fnc{n} = @stem; x{n} = -5:10;  y{n} = (2).^(x{n}).*(x{n} >= 0); 
xlbl{n} = 'n'; ylbl{n} = 'h[n]'; 
caption{n} = 'Undesirable, unstable impulse response';
n = n + 1;

% Causality **********
fnc{n} = @stem; x{n} = -5:10;  y{n} = (0.5).^(x{n}).*(x{n} >= 0); 
xlbl{n} = 'n'; ylbl{n} = 'h[n]'; 
caption{n} = 'Desirable, causal impulse response';
n = n + 1;


fnc{n} = @stem; x{n} = -5:10;  y{n} = (2).^(x{n}).*(x{n} < 0); 
xlbl{n} = 'n'; ylbl{n} = 'h[n]'; 
caption{n} = 'Undesirable, anti-causal impulse response';
n = n + 1;

% Group Delay **********
fnc{n} = @plot; x{n} = -1:0.001:1;  y{n} = mod(-sign(x{n}).*x{n}.^2-1,2*1)-1;
xlbl{n} = '\omega'; ylbl{n} = '\angle H(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1]; figwidth{n} = 2.0;
caption{n} = 'A non-linear phase response';
n = n + 1;

fnc{n} = @plot; x{n} = -1:0.001:1;  y{n} = -y{n-1}./x{n};
xlbl{n} = '\omega'; ylbl{n} = 'M_{ph}(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1]; figwidth{n} = 2.0;
caption{n} = 'Phase delay of non-linear phase response';
n = n + 1;

fnc{n} = @plot; x{n} = -1:0.001:(1-0.001);  y{n} = mod(-diff(y{n-2})/0.001-1,2)-1;
xlbl{n} = '\omega'; ylbl{n} = 'M_{gr}(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1]; figwidth{n} = 2.0;
caption{n} = 'Group Delay of non-linear phase response';
n = n + 1;



% Linear Phase Impulse Response **********
fnc{n} = @stem; x{n} = -10:10;  y{n} = -(x{n}==-2+2)+2*(x{n}==-1+2)+(x{n}==0+2)+2*(x{n}==1+2)-(x{n}==2+2);
xlbl{n} = 'n'; ylbl{n} = 'h[n]';
caption{n} = 'A linear phase response (with even impulse response)';
n = n + 1;

fnc{n} = @stem; x{n} = -10:10;  y{n} = -(x{n}==-2+2)+2*(x{n}==-1+2)-2*(x{n}==1+2)+(x{n}==2+2);
xlbl{n} = 'n'; ylbl{n} = 'h[n]';
caption{n} = 'A linear phase response (with odd impulse response)';
n = n + 1;


% Linear Phase **********
fnc{n} = @plot; x{n} = -1:0.001:1;  y{n} = mod(-x{n}-1,2*1)-1;
xlbl{n} = '\omega'; ylbl{n} = '\angle H(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1];
caption{n} = 'A linear phase response (with even impulse response)';
n = n + 1;

fnc{n} = @plot; x{n} = -1:0.001:1;  y{n} = mod(-x{n}-1-1,2*1)-1;
xlbl{n} = '\omega'; ylbl{n} = '\angle H(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1];
caption{n} = 'A linear phase response  (with even impulse response)';
n = n + 1;

fnc{n} = @plot; x{n} = -1:0.001:1;  
y{n} = (mod(-x{n}+1/2-1,2*1)-1).*(x{n} >= 0) + (mod(-x{n}-1/2+1,2*1)-1).*(x{n} < 0);
xlbl{n} = '\omega'; ylbl{n} = '\angle H(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1];
caption{n} = 'A linear phase response  (with odd impulse response)';
n = n + 1;

fnc{n} = @plot; x{n} = -1:0.001:1;  
y{n} = (mod(-x{n}+1/2-1+1,2*1)-1).*(x{n} >= 0) + (mod(-x{n}-1/2+1+1,2*1)-1).*(x{n} < 0);
xlbl{n} = '\omega'; ylbl{n} = '\angle H(\omega)'; xTickSuffix{n} = '\pi';
yTickSuffix{n} = '\pi'; axis{n} = [-1 1 -1 1];
caption{n} = 'A linear phase response  (with odd impulse response)';
n = n + 1;




axis{n}        = [];
figwidth{n}    = [];
hidexticks{n}  = [];
hideyticks{n}  = [];
marker{n}      = [];
markersize{n}  = [];
xTickPrefix{n} = [];
xTickSuffix{n} = [];
yTickPrefix{n} = [];
yTickSuffix{n} = [];
xTick{n}       = [];
yTick{n}       = [];
caption{n}     = [];

figwidth{n} = [];

for n = 1:length(x)
    plotforclass( 'fnc', fnc{n}, 'x', x{n}, 'y', y{n}, ...
                  'flname', [namebase 'fig' num2str(n, '%03u')], ...
                  'xlbl', xlbl{n}, 'ylbl', ylbl{n}, 'figwidth', figwidth{n}, ...
                  'hidexticks', hidexticks{n}, 'marker', marker{n}, ...
                  'markersize', markersize{n}, 'axis', axis{n}, ...
                  'xTickPrefix', xTickPrefix{n}, 'xTickSuffix', xTickSuffix{n}, ...
                  'yTickPrefix', yTickPrefix{n}, 'yTickSuffix', yTickSuffix{n}, ...
                  'hideyticks', hideyticks{n}, 'xTick', xTick{n}, 'yTick', yTick{n}, ...
                  'caption', caption{n}, 'captionFile', [namebase 'caption' num2str(n, '%03u') '.html']);
	
    
end


end

