N  = 64;                % simulation length (output samples)
cycles = 2;             % number of sinusoids
A  = 0.8;               % signal amplitude
offset = 0;
fs = 1;                 % sampling frequency 
T  = 1/fs;              % time step
fx = cycles / (N*T);    % signal frequency

[t,x,y] = sim('sigma_delta_L1_sim', T*(N-1));

X = y(:,1);
Q = y(:,2);
Y = y(:,3);

plot(t, X, 'rx-', t, Q, 'g');
axis([ min(t) max(t) 1.1*min(Q) 1.1*max(Q) ]);
hold on;
stairs(t, Y, 'b');
xlabel('Time   [ t/T ]');
ylabel('Amplitude');
legend('X', 'Q', 'Y');
title('1st Order Sigma-Delta');
hold off;