Reza.mrk77
Newbie level 2
Hi,
I am trying to simulate the second order sigma-delta modulator in MATLAB. According to the books, the in-band noise is calculated from:
n = 10*log10((0.25/12)*((pi^4)/5)*(1/OSR)^5)
(My quantization step is 0.5 and so the 0.25 is its squared)
Above value is around -44 dB.
I am simulating this second order modulator for input range from -50 dB up to -6 dB(FS) but the simulation result does not match with the hand calculations.
this is my code:
------------------------------------------
and the SNR plotted:
As you see the simulation SNR is around 25 dB higher than the calculated SNR.
What is the problem?
Thanks.
I am trying to simulate the second order sigma-delta modulator in MATLAB. According to the books, the in-band noise is calculated from:
n = 10*log10((0.25/12)*((pi^4)/5)*(1/OSR)^5)
(My quantization step is 0.5 and so the 0.25 is its squared)
Above value is around -44 dB.
I am simulating this second order modulator for input range from -50 dB up to -6 dB(FS) but the simulation result does not match with the hand calculations.
this is my code:
Code:
%second order delta modulation with 4 level
clear
clc
l = 1;
for A = 0.004:0.001:1
fs = 84;
t = 0:1/fs:5 - 1/fs;
fb = 5;
x = A*sin(2*pi*t); %input signal
z = 0;
OSR = fs/(2*fb);
for m=1:1:length(x)
u1(m) = x(m) - z;
if m ~=1 v1(m) = u1(m) + v1(m-1);
else v1(m) = 0;
end
u2(m) = v1(m) - z;
if m ~= 1 v2(m) = u2(m)+v2(m-1);
else v2(m) = 0;
end
if v2(m) < -0.5
y(m) = -1;
z = -1;
end
if (v2(m) >= -0.5 && v2(m) < 0)
y(m) = -0.5;
z = -0.5;
end
if (v2(m) >= 0 && v2(m) < 0.5)
y(m) = 0;
z = 0;
end
if (v2(m) >= 0.5 && v2(m) < 1)
y(m) = 0.5;
z = 0.5;
end
if v2(m) >= 1
y(m) = 1;
z = 1;
end
end
% plot(x)
% hold
% stairs(y)
y_fft = abs(fft(y))/(m);
%plot(10*log10(y_fft))
[~, sigBin] = max(abs(y_fft));
sigBin = 6;
sigPower = y_fft(sigBin)*conj(y_fft(sigBin));
noisePower = sum(y_fft(1:sigBin-1).*conj(y_fft(1:sigBin-1)));
SNR = 10*log10(sigPower/noisePower);
predSNR = 10*log10(sigPower)-10*log10((0.25/12)*((pi^4)/5)*(1/OSR)^5);
SNR1(l) = SNR;
predSNR1(l) = predSNR;
X2(l) = A;
X1(l) = 10*log10(sigPower);
l = l + 1;
end
plot(X1, SNR1)
hold on
plot(X1, predSNR1)
and the SNR plotted:
As you see the simulation SNR is around 25 dB higher than the calculated SNR.
What is the problem?
Thanks.
Last edited by a moderator: