Brian Park, David Luong, Mark Piper, Aron Dobos

Lab 3, E71 Digital Signal Processing, 2/05/2006

 

Quantization Noise Effect


 

1.  Quantization of Sinusoidal Signal (rounding to nearest integer bit)

 

The experimental and theoretical SQNR’s were very similar.  As the number of bits increased, so did the SQNR as we would expect.  The graphs and the results in the table are generated using the Matlab script.  Note: X denotes the original signal and xd is the quantized signal for all graphs in this lab.

 

Bits

Experimental SQNR (dB)

Theoretical SQNR (dB)

Mean Quantization Noise

Variance in Quantization Noise

4

26.201

25.84

2.89E-02

1.20E-03

8

49.7767

49.92

1.98E-03

5.17E-06

12

74.8614

74.00

1.07E-04

1.63E-08

16

98.0608

98.08

7.59E-06

7.85E-11

t=0:0.1:4*pi;

fprintf('Exp\t\tTh\t\tMean\t\tVar\n');

for n=4:4:16,

    x=sin(t);

    xd=round(x*2^(n-1))/2^(n-1);

    error=xd-x;   

    error_mean=mean(abs(error));

    error_variance=var(error);

    figure; plot(t,x,t,xd,t,error)

    legend('x','xd','error')

    SQNR=10*log10(sum(x.^2)/sum(error.^2)); 

    SQNR_eqn=1.76+6.02*n;

    title(strcat(num2str(n),' bits. SQNR=',num2str(SQNR),' dB.'))    fprintf('%0.4f\t%0.4f\t%0.3e\t%0.3e\n',SQNR,SQNR_eqn,error_mean,error_variance);   

end

 


 

2.  Quantization of Sinusoidal Signal (truncating to integer bit)

 

The experimental SQNR was always lower than the theoretical value.  This was expected because instead of rounding the data as in part 1, we truncated, which leads to less accurate quantization of the signal and a lower SQNR.

 

Bits

Experimental SQNR (dB)

Theoretical SQNR (dB)

Mean Quantization Noise

Variance in Quantization Noise

4

19.3759

25.84

6.54E-02

1.49E-03

8

44.0569

49.92

3.82E-03

5.06E-06

12

68.1629

74

2.29E-04

2.38E-08

16

91.9115

98.08

1.56E-05

7.97E-11

 

t=0:0.1:4*pi;

fprintf('Exp\t\tTh\t\tMean\t\tVar\n');

for n=4:4:16,

    x=sin(t);

    xd=floor(x*2^(n-1))/2^(n-1);

    error=xd-x;   

    error_mean=mean(abs(error));

    error_variance=var(error);

    figure; plot(t,x,t,xd,t,error)

    legend('x','xd','error')

    SQNR=10*log10(sum(x.^2)/sum(error.^2)); 

    SQNR_eqn=1.76+6.02*n;

    title(strcat(num2str(n),' bits. SQNR=',num2str(SQNR),' dB.'))    fprintf('%0.4f\t%0.4f\t%0.3e\t%0.3e\n',SQNR,SQNR_eqn,error_mean,error_variance);   

end

 


 

3.  Quantization of Gaussian Noise Signal

 

As expected, the SQNR tends to increase with the number of bits used to quantize the signal.

 

Bits

Experimental SQNR (dB)

Mean Quantization Noise

Variance in Quantization Noise

4

29.1933

3.22E-02

1.34E-03

8

52.0926

1.86E-03

4.82E-06

12

77.1105

1.23E-04

1.99E-08

16

101.1026

7.33E-06

7.52E-11

 

t=0:0.1:4*pi;

fprintf('Exp\t\tTh\t\tMean\t\tVar\n');

for n=4:4:16,

    x=randn(1,length(t));

    xd=round(x*2^(n-1))/2^(n-1);

    error=xd-x;   

    error_mean=mean(abs(error));

    error_variance=var(error);

    figure; plot(t,x,t,xd,t,error)

    legend('x','xd','error')

    SQNR=10*log10(sum(x.^2)/sum(error.^2)); 

    SQNR_eqn=1.76+6.02*n;

    title(strcat(num2str(n),' bits. SQNR=',num2str(SQNR),' dB.')) fprintf('%0.4f\t%0.4f\t%0.3e\t%0.3e\n',SQNR,SQNR_eqn,error_mean,error_variance);

end

 


 

4.  Quantization of Sinusoidal Signal with Gaussian Random Noise

 

As we expected, the SNR is approximately 20dB because that is the specified effect of the Gaussian noise we added to the signal.  The quantization noise decreases with increasing number of bits used and leads to a higher SQNR.

 

Bits

Experimental SNR (dB)

Experimental SQNR (dB)

Theoretical SQNR (dB)

Mean Quantization Noise

4

19.0702

29.1933

25.84

3.22E-02

8

19.7978

52.0926

49.92

1.86E-03

12

19.646

77.1105

74

1.23E-04

16

19.4478

101.1026

98.08

7.33E-06

 

t=0:0.1:4*pi;

fprintf('SNR\t\tExp\t\tTh\t\tMean\n');

for n=4:4:16,

    x_original=sin(t);

    noise=randn(1,length(t))./sqrt(200);

    x=x_original+noise;

    xd_original=round(x_original*2^(n-1))/2^(n-1);

    xd=round(x*2^(n-1))/2^(n-1);

    error_original=xd_original-x_original;

    error=xd-x;

    error_mean=mean(abs(error));

    figure; plot(t,x,t,xd,t,error)

    legend('x','xd','error')

    SNR=10*log10(sum(x.^2)/(sum(error.^2)+sum(noise.^2)));

    SQNR=10*log10(sum(x.^2)/(sum(error.^2)));

    SQNR_eqn=1.76+6.02*n;

    title(strcat(num2str(n),' bits. SNR=',num2str(SNR),' dB.'))    fprintf('%0.4f\t%0.4f\t%0.4f\t%0.3e\n',SNR,SQNR,SQNR_eqn,error_mean);

end