% expfun_stab.m - exponential function plots for stable system
% KJA, 2012

aminit;					% initialize FBS macros

% Response of first order stable system
t = 0:0.1:4;
y = exp(-t);
y1 = max(0, 1-t);

subplot(331)
pl = plot(t, y, 'b-', t, y1, 'b--');
set(pl,  'LineWidth',  AM_data_linewidth);
set(gca, 'Ytick', [0 0.5 1]);
amaxis([0 4 0 1.1])
title('real stable')
xlabel('tf')
ylabel('y')

% Second order system
t = 0:0.1:16;
ys = exp(-0.25*t).*sin(t);
yc = exp(-0.26*t).*cos(t);
yu = exp(-0.25*t);
yl = -yu;
y0 = zeros(size(t));

subplot(334);
p1 = plot(t/4, ys, 'b-', t/4, yc, 'b--', t, y0, t/4, yu, 'b:', t/4, yl, 'b:');
set(p1,  'LineWidth',  AM_data_linewidth);
set(gca, 'Ytick', [-0.5 0 0.5 1]);
amaxis([0 4 -0.5 1.0])
xlabel('ts');
ylabel('y');
title('complex stable')

amprint('expfun-stab.eps')

