# Sigma Delta Modulation - SNR calculation

Started by July 22, 2005
```Hello All,

I have created a simple routine in MATLAB that simulates a second order
sigma delta modulator.  I am now trying (with some difficulty) to
calculate the SNR of the modulator given sinusoidal inputs.  My
understanding of how this procedure should be carried out is as follows,

1) Build the output of the modulator by running my routine. The
quantization error in the ouput would then be q=x-y where x is the inpu
and y is the ouput.

2) Find the power of the input sine, x=A*sin(w*t), Ssine=A^2/2

3) Find the quantization error power spectrum,
Pq=abs(fft(q,Nfft)).^2/size(q)^2

4) Find the in-band quantization noise power by summing the error power
over the baseband frequencies. call this result Sb

5) The SNR should then be found as SNR=10*log10(Ss/Sb)

I am familiar with the linearized model for sigma delta modulators and the
resulting methods for determining the noise transfer functions, and maximum
SNRs.  The results I've gotten so far are unconvincing to me because the
SNRs I have calculated for various simulations come out to be far greater
than those found by using the linearized model.  Any help would be greatly
appreciated.

~Brian

This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
```
```bpiletrue wrote:
> Hello All,
>
> I have created a simple routine in MATLAB that simulates a second order
> sigma delta modulator.  I am now trying (with some difficulty) to
> calculate the SNR of the modulator given sinusoidal inputs.  My
> understanding of how this procedure should be carried out is as follows,
>
> 1) Build the output of the modulator by running my routine. The
> quantization error in the ouput would then be q=x-y where x is the inpu
> and y is the ouput.

I would estimate the amplitude and phase of the sine in the output and
construct a signal, call it y_s, and take the noise as q = y - y_s.
This means that you'll also have to characterize your S-D modulator by
the gain and phase changes, but I think it'll give you a better picture.
>
> 2) Find the power of the input sine, x=A*sin(w*t), Ssine=A^2/2

Or y_s.
>
> 3) Find the quantization error power spectrum,
>    Pq=abs(fft(q,Nfft)).^2/size(q)^2
>
Yup.

> 4) Find the in-band quantization noise power by summing the error power
> over the baseband frequencies. call this result Sb

So you want to define a frequency range in which you're going to
consider noise?  That's probably a good thing.  I'd double check that
the total noise power calculated by FFTs equals the temporal noise power
of Pq -- FFTs always seem to scale things in a way that requires a bit
of pondering and experamintation to get straight.
>
> 5) The SNR should then be found as SNR=10*log10(Ss/Sb)

Well, SNR in dB, yes.
>
> I am familiar with the linearized model for sigma delta modulators and the
> resulting methods for determining the noise transfer functions, and maximum
> SNRs.  The results I've gotten so far are unconvincing to me because the
> SNRs I have calculated for various simulations come out to be far greater
> than those found by using the linearized model.  Any help would be greatly
> appreciated.
>
My experience with trying to understand 2nd-order S-D modulators has
always left me disappointed.  I never get as good of results as I expect
-- in fact so far I've stuck with 1st-order S-D modulators because
they've always been good enough for me, simple, and I knew what I was
dealing with.

Check your time-domain output, and see if it's what you were expecting.

One day, though, I'm gonna wrestle the 2nd-order S-D snake to the ground!

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```
```Thanks for the reply Tim.  One question, when I spoke about the output of
the modulator I was referring to the output prior to lowpass
filtering/decimation.  In my simulation, this is made up of a signal
bouncing between + and - delta/2 (delta is the quantization step).  So I
have been finding the power spectrum of the error between the input and
this signal.  You wrote,

>I would estimate the amplitude and phase of the sine in the output and
>construct a signal, call it y_s, and take the noise as q = y - y_s.
>This means that you'll also have to characterize your S-D modulator by
>the gain and phase changes, but I think it'll give you a better picture.

Does this mean that I should apply the filtering to my output to recover
the sine input, and then estimate the amplitude and phase of the recovered
sine, called y_s?

~Brian

This message was sent using the Comp.DSP web interface on
www.DSPRelated.com
```
```bpiletrue wrote:
> Thanks for the reply Tim.  One question, when I spoke about the output of
> the modulator I was referring to the output prior to lowpass
> filtering/decimation.  In my simulation, this is made up of a signal
> bouncing between + and - delta/2 (delta is the quantization step).  So I
> have been finding the power spectrum of the error between the input and
> this signal.  You wrote,
>
>
>>I would estimate the amplitude and phase of the sine in the output and
>>construct a signal, call it y_s, and take the noise as q = y - y_s.
>>This means that you'll also have to characterize your S-D modulator by
>>the gain and phase changes, but I think it'll give you a better picture.
>
>
> Does this mean that I should apply the filtering to my output to recover
> the sine input, and then estimate the amplitude and phase of the recovered
> sine, called y_s?
>
Even if I were working with the raw modulator output I'd still take a
whack at extracting y_s -- I'd at least look at the spectrum of your q
to see if it has any significant content at the sine frequency.  Your
signal can't be making it through the modulator without being delayed by
at least 1/2 sample and possibly more; I'd go ahead and check on what's
really happening.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
```