% fixed sample time, 16 levels of amp
dt = 0.01 ;
t = [0:dt:10*pi]; % Times at which to sample the sine function
sig = 7.5*sin(t); % Original signal, a sine wave
sig_16 = fix(sig);
[b,a] = butter(1, 0.05);
f = filter(b,a,sig_16);

figure(1);clf
subplot(1,2,1)
plot(t,sig_16, 'linewidth', 2);
hold on
plot(t,sig, 'r');
%plot(t,f, 'g');

subplot(1,2,2)
plot(log10(abs(fft(sig_16))), 'linewidth', 2)
hold on
plot(log10(abs(fft(sig))), 'r')

%plot(log10(abs(fft(f))), 'g')

set(gca, 'xlim',[1 25])
set(gca, 'ylim',[0 5])
ylabel('log 10 of voltage')
xlabel('relative frequency')
    


