N  = 2^10;              % simulation length (output samples)
A  = 0.99;              % signal amplitude
offset = 0.00001;
fs = 1;                 % sampling frequency 
T  = 1/fs;              % time step
fx = 0.1 + 0.000001;   % signal frequency

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

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

s = abs(fft(Y .* w)) / sqrt(N);
s = s(1:N/2);
f = (0:length(s)-1) / N;

plot(f, 20*log10(s+eps));
xlabel('Frequency   [ f/f_s ]');
ylabel('Amplitude   [ dBWN ]');
axis([0 0.5 -80 30]);
fixfig;
