Code covered by the BSD License  

Highlights from
Delta Sigma converter spurious tone predictor

image thumbnail

Delta Sigma converter spurious tone predictor

by

 

25 Nov 2010 (Updated )

A simple analytical model that predicts DSM spurious tones with arbitrary stimulus.

dsm_qnoise_model(u,N,BPmode,L)
function [e_hat,Nspurs] = dsm_qnoise_model(u,N,BPmode,L)
% e_hat = dsm_qnoise_model(u,N,Nspurs,BPmode,L,pflag)
% quantizer noise model for DSM.
% So far, very accurate for 1st order lowpass and 2nd order bandpass DSM.
%
% u         stimulus vector  normalized between [-N,N] 
%           (just like simulateDSM in DS toolbox)
% N         number of quantizer steps
%           note: number of quantizer levels = N+1
% Bpmode    1, if bandpass DSM, else 0
%           note that u should be bandpass as well for BPmode = 1
% L         DSM order
% e_hat     the quantization noise estimate
% Nspurs    number of spurs estimated
%
% % To generate modulation noise model, filter the output e_hat with the 
% % DSM noise tf:
% ntf = synthesizeNTF(2,32); % download Delta-Sigma toolbox (File ID: #19) 
% n_hat = filter(NUM,DEN,e_hat); %modulation noise estimate
% % And to estimate SNR:
% v_hat = u+n_hat; % -> find SNR

QSTEP=2; %normalized to dstoolbox step
if rem(N,2)
    uoffset = QSTEP*0.5;
else
    uoffset = 0;
end

NT = length(u);
e_hat = zeros(1,NT);

if BPmode
    Af = [1,0,0];
    Bf = [1,0,1];
    fc=0.25;
else
    Af = [1,0];
    Bf = [1,-1];
    fc=0;
end

if L<4 && rem(N,2)
    p = [
        -1.958948344182117   5.044492106506190  -7.055295364055410   8.334364561858429  -5.365817455286532  -0.064285846600190   2.257543740766184
        12.858141233334953 -21.000028883283761  -3.436366818105694  23.316697830966564 -15.950415216026952   2.988760476656425   1.846948475822941
        8.777956464158615 -40.571121460392789  48.262300286120286 -20.799137687247672   0.577563258978622   0.508454548710523   1.878637053652785];
    p=p(L,:);
    qg = polyval(p,abs(u));
else
    qg=1;
end

beta1 = 4/3/pi;

if BPmode
    kpower = L/2;  %(L*2-1);
else
    kpower = L;
end

switch kpower
    case 1
        Nspurs = 100;
    case 2
        Nspurs = 28;
    case 3
        Nspurs = 13;
    otherwise
        Nspurs = 10;
end


if BPmode
    phi = (1-qg)*2*pi*2;
else
    phi = (1-qg)*2*pi;
end

for k = 1:Nspurs
    fd=k/QSTEP;    
    u_integral = filter(Af,Bf,u+uoffset);
    fspur = fc+fd*u_integral;
    
    gamma = cos(2*pi*fspur+phi);
    
    beta = beta1*1/k^kpower;
    
    temp = beta*gamma;
    e_hat = e_hat + temp;
end

Contact us