aminit;

%Simulation of relay feedback
%kja 040806
tspan=[0,30];
x0=[0.01;0;0;0];
[t,x]=ode45('relayfb',tspan,x0);
u=-sign(x(:,1));

figure(1); clf; subplot(321); hold on;
plot(t, u, '--', t, x(:,1), '-', 'LineWidth', AM_data_linewidth);
plot(t, zeros(size(t)) , 'k-', 'LineWidth', AM_ref_linewidth);

ylabel('u, y'); xlabel('t');
amaxis([0 30 -1.2 2]); box on;
lgh = legend('{\itu}', '{\ity}', 'Orientation', 'horizontal');
legend(lgh, 'boxoff');

amprint('relayfbsim.eps');
