tipu wrote on Jun 25th, 2008, 7:50am:What you have done is that you have multiplied the center frequency (which is 1/4) with the total number of FFT points (8192) in this case so that tone_bin will be lying in one of those FFT points??
Yes. It is very very very common in SNR evaluation of sinusolidal signal using DFT.
You don't seem to understand DFT(FFT).
I think you should learn DFT before studying delta sigma modulation theory.
tipu wrote on Jun 25th, 2008, 7:50am:I wanted to enquire about it in general terms?
It is general.
tipu wrote on Jun 25th, 2008, 7:50am:lets suppose that I am designing a LOW pass system with 1 MHz sampling frequency,20K center frequency
Where do you want to locate zeros of NTF ?
Do you want to locate them around 20kHz ?
If so, this is Bandpass Delta Sigma not Lowpass Delta Sigma.
tipu wrote on Jun 25th, 2008, 7:50am:and 4k Bandwidth(it's just an imaginary situation),then what would be my tone_bin?
What do you mean by "
an imaginary situation" ?
OSR=125, tone_bin=165
Code:% The Designer's Guide Community Forum>Design>Mixed-Signal Design>Bandpass Sigma Delta Converter
% http://www.designers-guide.org/Forum/YaBB.pl?num=1213204643/0
close all, clear, clc
stdout = 1;
%Parameters
order = 2;
nLev = 2;
opt = 2;
H_inf = 1.6;
fs = 1e6;
%f0 = 1/4;
f0 = 20e3/fs; % Normalized by fs
%OSR = 128;
BW = 4e3;
OSR = fs/(2*BW);
fprintf(stdout, 'OSR=%d\n', OSR);
Nfft = 2^13;
Tstep = 1; % Normalized by (1/fs)
Textra = 100*Tstep;
Tstop = Nfft*Tstep + Textra;
delta_f = 1/(Tstop-Textra);
%tone_bin=57;
tone_bin = fix(f0/delta_f + 0.5);
if mod(tone_bin, 2) == 0
tone_bin = tone_bin + 1;
end
fprintf(stdout, 'tone_bin=%d\n', tone_bin);
t1 = fix(Textra/Tstep);
t2 = t1 + Nfft-1;
t = 0:t2;
u = 0.5*(nLev-1)*sin(2*pi*(tone_bin)/Nfft*t);
n = 1:150;
n = n + t1;
%Synthesizing the NTF:
H = synthesizeNTF(order, OSR, opt, H_inf, f0);
%Pole Zero Plot,Rms Gain
figure(1), plotPZ(H); grid on
f = linspace(0, 0.5, 1000);
%figure(2), z = exp(2i*pi*f); plot(f,dbv(evalTF(H, z)));
figure(2), plot( f, dbv(squeeze(freqresp(H, 2*pi*f))) )
grid on
sigma_H = dbv(rmsGain(H, f0-0.25/OSR, f0+0.25/OSR));
%Plotting the Output in the time Domain
figure(3), hold on
v = simulateDSM(u, H, nLev);
stairs(t(n), u(n), 'g');
stairs(t(n), v(n), 'b')
grid on
%Calculating the Spectral Contents of the modulator
%Determining the SNR
figure(4), hold on
spec = fft( v(t1:t2) .* hann(Nfft) ) / (Nfft*(nLev-1)/4);
snr = calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1), tone_bin);
NBW = 1.5/Nfft;
f = linspace(0, 0.5, Nfft/2+1);
plot(f, dbv(spec(1:Nfft/2+1)), 'b')
%z = exp(2i*pi*f); Sqq = 4*( evalTF(H, z) / (nLev-1) ) .^ 2/3;
Sqq = 4*( freqresp(H, 2*pi*f) / (nLev-1) ) .^ 2/3;
plot(f, dbp(squeeze(Sqq)*NBW), 'm', 'Linewidth', 1);
grid on
%The Dynamic Range plotting
%Peak SNR
figure(5);
amp = [-90:5:-20 -17:2:-1];
snr = simulateSNR(H, OSR, amp, f0, nLev);
plot(amp,snr, '-b', amp,snr, 'db');
[pk_snr pk_amp] = peakSNR(snr, amp);
grid on
form = 'CRFB';
[a,g,b,c] = realizeNTF(H, form);
b(2:end) = 0;
%ABCD Matrix
[ABCD] = stuffABCD(a, g, b, c, form);
xLim = 1;
[ABCDs umax] = scaleABCD(ABCD, nLev, xLim);
[a g b c] = mapABCD(ABCDs, form);
[NTF STF] = calculateTF(ABCD);