% signals.m Examples of exponential signals
% kja 060806

aminit;

%First order system
t=0:0.01:4;
%Constant
subplot(331)
t=0:0.01:4;
y=exp(0*t);
p1=plot(t,y,'b-');
set(p1,'linewidth', AM_data_linewidth)
amaxis([0 1 0 1.2])
xlabel('x')
ylabel('y')

amprint('signals-1.eps'); clf;

%Stable exponent
subplot(332)
y=exp(-t);
ya=1-t;
plot(t,y,'b-','linewidth', AM_data_linewidth);
% hold on; plot(t,ya,'r--');
amaxis([0 4 0 1.2])
xlabel('x')
ylabel('y')

amprint('signals-2.eps'); clf;

%Unstable exponent
y=exp(1*t);
ya=1+t;
subplot(333)
plot(t,y,'b-','linewidth', AM_data_linewidth);
% hold on; plot(t,ya,'r--');
amaxis([0 1 0 3])
xlabel('x')
ylabel('y')

amprint('signals-3.eps'); clf;

%Second order system
t=0:0.1:16;
%Undamped
% wn=1;z=0;w=wn*sqrt(1-z^2);sigma=z*wn;
w = 1; sigma = 0;
y=exp(-sigma*t).*sin(w*t);
yu=exp(-sigma*t);
y0=zeros(size(t));
subplot(334)
plot(t,y,'b-', 'linewidth', AM_data_linewidth)
amaxis([0 16 -1.2 1.2])
hold on; plot(t,y0, AM_ref_linestyle, 'linewidth', AM_ref_linewidth);
xlabel('x');
ylabel('y');

amprint('signals-4.eps'); clf;

%
% wn=1;z=0.2;w=wn*sqrt(1-z^2);sigma=z*wn;
w = 1; sigma = 0.2;
y=exp(-sigma*t).*sin(w*t);
yu=exp(-sigma*t); yl=-yu;
y0=zeros(size(t));
subplot(335)
p1=plot(t,y,'b-',t,yu,'r--',t,-yu,'r--');
hold on;
set(p1,'linewidth', AM_data_linewidth)
hold on; plot(t,y0, AM_ref_linestyle, 'linewidth', AM_ref_linewidth);
amaxis([0 16 -1 1])
xlabel('x');
ylabel('y')

amprint('signals-5.eps'); clf;

% Unstable, oscillatory
% wn=1;z=-0.2;w=wn*sqrt(1-z^2);sigma=z*wn;
w = 1; sigma = -0.2;
y=exp(-sigma*t).*sin(w*t);
yu=exp(-sigma*t);
y0=zeros(size(t));
subplot(336)
plot(t,y,'b-', 'linewidth', AM_data_linewidth);
hold on; plot(t,yu,'r--',t,-yu,'r--', 'linewidth', AM_data_linewidth);
hold on; plot(t,y0, AM_ref_linestyle, 'linewidth', AM_ref_linewidth);
amaxis([0 16 -20 20])
xlabel('x');
ylabel('y')

amprint('signals-6.eps');
