# who can explain this DSM matlab code to me - I am new for this

Status
Not open for further replies.

#### 6716914

##### Newbie level 5
%% Simulate the DSM in time
Nfft = 2^13;
tone_bin = 31; what is tone_bin?
t = 0:Nfft-1;

u = 1*(nLev-1)*sin(2*pi*tone_bin/Nfft*t); why the input signal has to be this, what this means
v = simulateDSM(u,Ha,nLev);

figure()
n=1:1000;
plot(t, u, 'g');
hold on; grid on;
stairs(t, v, 'b');
title('DSM time-domain Simulation');

%% Plot the Spectrum
spec = fft(v.*ds_hann(Nfft))/(Nfft*(nLev-1)/4); what this means
snr = calculateSNR(spec(1:ceil(Nfft/(2*OSR))+1), tone_bin);
Neff = (snr-1.76)/6.02;

NBW = 1.5/Nfft; why 1.5
f = linspace(0, 0.5, Nfft/2+1);
Sqq = 4*(evalTF(Ha, exp(2i*pi*f))/(nLev-1)).^2/3;

figure()
plot(f, dbv(spec(1:Nfft/2+1)), 'b')
hold on; grid on;
plot(f, dbp(Sqq*NBW), 'm', 'Linewidth', 1);
title('DSM Output Spectrum');

#### guguwuwu

##### Newbie level 6
I don't know your real means and think of for:
"tone_bin" is a variable to determine the length of the signal.
"u = 1*(nLev-1)*sin(2*pi*tone_bin/Nfft*t)" is an sine signal. The frequency is tone_bin/Nfft.The amplitude is (nLev-1).
"spec = fft(v.*ds_hann(Nfft))/(Nfft*(nLev-1)/4);" is an FFT operation to the signal in bracket.

#### 6716914

##### Newbie level 5
thanks, i know your mean, but i asked why it has to be like that, for example, why the sin signal frequency has to be the tone_bin/Nfft. and for NBW, why NBW=1.5/Nfft

#### monsoon

##### Member level 3
If you have a signal with periodicity N, and you take N point DFT, then the DFT resolution is 2pi/N. 2pi/N and its harmonics are called bins. If the signal is of the form sin(2pi*31*n/N), it is said to be on 31st bin.

Say you choose sin(wo n) as your input signal. If you intend to take N point DFT, then this signal must be periodic with period N. This implies that wo=2*pi*k/N, where k is any integer. In other words signal must be on a bin. If signal is not on a bin, it leads to what is called spectral leakage and the noise floor rises well above its actual level.

In delta sigma even when the signal is taken on a bin , the output is not periodic because of strong presence of shaped quantization noise. To overcome spectral leakage, output sequence is multiplied by a window ( in this case hann window). Windowing removes spectral leakage.

As for your last question, I am not sure whats going on

#### 6716914

##### Newbie level 5
If you have a signal with periodicity N, and you take N point DFT, then the DFT resolution is 2pi/N. 2pi/N and its harmonics are called bins. If the signal is of the form sin(2pi*31*n/N), it is said to be on 31st bin.

Say you choose sin(wo n) as your input signal. If you intend to take N point DFT, then this signal must be periodic with period N. This implies that wo=2*pi*k/N, where k is any integer. In other words signal must be on a bin. If signal is not on a bin, it leads to what is called spectral leakage and the noise floor rises well above its actual level.

In delta sigma even when the signal is taken on a bin , the output is not periodic because of strong presence of shaped quantization noise. To overcome spectral leakage, output sequence is multiplied by a window ( in this case hann window). Windowing removes spectral leakage.

As for your last question, I am not sure whats going on
Thanks for your reply, my last question was, why NBW equals 1.5/Nfft, is there any explantion for the 1.5/Nfft.

#### monsoon

##### Member level 3
For a rectangular window NBW is 1/Nfft, but for a hann window it is 1.5/Nfft. You may refer to page 15 and 16.

#### Attachments

• 1.3 MB Views: 43

#### 6716914

##### Newbie level 5
For a rectangular window NBW is 1/Nfft, but for a hann window it is 1.5/Nfft. You may refer to page 15 and 16.
ThKs~~~ thanks

- - - Updated - - -

Do you have the other lecture slides about the DSM, I hope I can refer something...

Thnaks

Status
Not open for further replies.