# DSM Model Not Producing Expected Noise Shaping

I am trying to design a 2nd Order CIFB DSM ADC on Simulink based off the values I have extracted from Richard Schreier's Delta Sigma Modulation Toolbox. However, when I ran the model according to the values I used, it seems like there is not a sufficient amount of noise shaping in the system. Since this is second-order noise shaping, I am expecting roughly 40 dB attenuation per decade in noise. But it seems like there is only ~15 dB noise-shaping in this system. Could anyone possibly point out a flaw in my judgment or system? Below are the images of the Simulink implementation, the parameters used in the system, and the signal output.

%% Create DSM Model

close all;
clear all;

OSR = 500;
f = 5000;
N = 10^7;
fB = ceil(N/(2*OSR));

amplitude_list = [-120:10:-20 -15 -10:0];
order = 2;
nlevl = 2^5;
form = 'CIFB'

ntf = synthesizeNTF(order, OSR, 1, 2);
[sqnr, amp] = simulateSNR(ntf, OSR, [], [], nlevl);

[a,g,b,c] = realizeNTF(ntf,form);
ABCD = stuffABCD(a,g,b,c,form);
ABCD = scaleABCD(ABCD,nlevl,[],.5,[],.9);
[a,g,b,c] = mapABCD(ABCD,form);

plot(amp, sqnr,'*')

%% Simulate over MSA=.9 Sine Input

u = .9*sin(2*pi*f/N*[0:N-1]);
v = simulateDSM(u, ABCD, nlevl);

t = 0:85;
stairs(t, u(t+1),'g');
hold on;
stairs(t,v(t+1),'b');
axis([0 85 -1.2 1.2]);
ylabel('u, v');
spec=fft(v.*ds_hann(N))/(N/4);
plot(linspace(0,0.5,N/2+1), ...
dbv(spec(1:N/2+1)));
axis([0 0.5 -150 0]);
grid on;
ylabel('dBFS/NBW')
snr=calculateSNR(spec(1:fB),f);
s=sprintf('SNR = %4.1fdB\n',snr);
text(0.25,-90,s);
s=sprintf('NBW=%7.5f',1.5/N);
text(0.25, -110, s);

%% Continuous Time Conversion  • That quantizer on the right, just after the summer, how many bits or steps or quantization levels are there in that component? What is the gain that you're modeling for that block? Jan 25 at 16:14
• Perhaps the answer is nlevl, which suggests a 5-bit flash A/D converter. Is the gain of that block equal to 1? Jan 25 at 17:17

I believe the expected noise shaping for a 2nd order Sigma Delta ADC should actually be closer to 50 dB/decade (or 15 dB/octave: 3 dB/octave for a standard ADC and then +6 dB/octave for every order above that). See thought process below; a 2nd order Sigma Delta would have a noise shaping as given by $$50log_{10}(N)$$.
You can confirm the Noise Transfer Function (NTF) using freqz as an additional verification.
I've used Richard Schreier's Delta Sigma Modulation Toolbox and have had good results with it. The issue may be with the FFT itself. Ensure the time duration is long enough for the close in frequency resolution desired, and remove DC offset by subtracting the mean and use a good window (such as Kaiser window) prior to plotting as the spectral leakage of that offset can mask the true close in noise floor you are getting. Also be VERY careful about precision effects especially if transcribing coefficients. Use format long to display the full precision of the coefficient if copying it for another implementation. 