[LabVIEW]Sampling and quantization(采样和量化)

 

Introduction

I design two program diagrams to two exercises to verify the principle of sampling and quantization. In the simulation experiment of sampling, I use convolution operator to complete the sample the signal to get discrete signal. I generate the pulse signal by adjusting the duty of empty of square wave. In the simulation experiment of quantization, I use uniform quantization method and compared the signal noise ratios of the simulated signal and theoretical signal. And I have more deep comprehension about sampling and quantization by observing the result of the experiment. I also review the theories about sampling and quantization which I have leant in the theory lecture. In this lab, I learnt a new element in LabVIEW called formula node.

Lab results & Analysis

  1. Simulation of sampling:
  1. Principles of sampling:-

By Nyquist–Shannon sampling theorem, we can get the bound of our sampling rate.

During transmission, noise is introduced at top of the transmission pulse which can be easily removed if the pulse is in the form of flat top. Here, the top of the samples is flat i.e. they have constant amplitude. Hence, it is called as flat top sampling or practical sampling. Flat top sampling makes use of sample and hold circuit.

Theoretically, the sampled signal can be obtained by convolution of rectangular pulse p(t) with ideally sampled signal say yδ(t) as shown in the diagram:

[LabVIEW]Sampling and quantization(采样和量化)

Figure 1 principle of Flat top sampling

Impulse sampling can be performed by multiplying input signal x(t) with impulse train n=-∞+∞δt-nT  [LabVIEW]Sampling and quantization(采样和量化)of period ' T '. Here, the amplitude of impulse changes with respect to amplitude of input signal x(t).

[LabVIEW]Sampling and quantization(采样和量化)

Figure 2 principle of impulse sampling

  1. The program diagram in LabVIEW:

[LabVIEW]Sampling and quantization(采样和量化)

Figure 3 the diagram of ideal sampling

And the parameters of signal are frequency is 10HZ and the amplitude is 1.

 

  1. Results and analysis:

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 4 waveform of ideal sampling in time domain

 

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 5 waveform of ideal sampling in frequency domain

 

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 6 waveform of Flat-Top sampling in time domain

 

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 7 waveform of Flat-Top sampling infrequency domain

 

By obverting the figure generate by our experiment, we can find that the original signal is continuing in both time domain and amplitude domain. But for the signal after sampling, the signal in time domain is discrete. In amplitude, the signal is still continuing. And the top of the output waveform of Flat-Top sampling is flat. This property is very useful for us to do quantization at next step.

And we should avoid a kind of situation which is the frequency impulse signal is special multiple of the frequency of the original signal which will cause that the point we sample are all zeros. So, when we look at the output figure, we get nothing.

 

  1. Simulation of quantization:
  1. Principles of quantization:

Quantization is representing the sampled values of the amplitude by a finite set of levels, which means converting a continuous-amplitude sample into a discrete-time signal.

For uniform quantization, the middle value’ formula is:

Yi=floor((Y-Ymin)/delta) *delta + delta * 0.5+Ymin;

Delta is quantization interval, and the formula is:

Delta = (2*Ymax)/pow(2,R)

 

  1. The program diagram in LabVIEW:

The formula node’ detail is:

[LabVIEW]Sampling and quantization(采样和量化)

[LabVIEW]Sampling and quantization(采样和量化)

Figure 8 the diagram of quantization

  1. Results and analysis:

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 9 all waveform in time domain

 

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 10 waveform with R=1

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 11waveform with R=2

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 12waveform with R=3

 

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 13 waveform with R=4

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 14 waveform with R=5

 

[LabVIEW]Sampling and quantization(采样和量化)

Figure 15 waveform with R=6

 

We can find that with the value of R rising the quality of the output waveform is increasing. And the signal become discrete in either time domain and amplitude domain. So that if we want to get high quality output, we need to increase the value of R.

[LabVIEW]Sampling and quantization(采样和量化)

Figure 16 SNR AND TSNR

By obverting the figure16 which shows the relationship between simulated SNR and theoretical SNR, we can see that when we increase 1 bit as R’s value, the SNR will increase 6 dB. The line of simulated SNR is coincided with theoretical SNR which indicate that the simulated experiment is successful and reasonable.

  1. Question and feedback:

Question1:

Wee can look the flat top sampling as the signal through an ideal sampling then use an h(t)(this operator can be thought as translation of the pulse made by ideal sampling )

Question2:

Except the situation when R equals 1; the value of simulated SNR is not as same as the theoretical SNR. The simulated SNR is as same as the theoretical SNR in the other values of R.

Question3:

We can find that when we increase 1 bit as R’s value, the SNR will increase 6 dB.

Feedback1:

[LabVIEW]Sampling and quantization(采样和量化)

We can see the envelope of this figure; we can find that the envelope is decreasing with frequency increasing. The reason is the envelope of the signal is a sinc function. So that the envelope is decreasing.

Feedback2:

The uniform quantization is only optimal for uniformly distributed signal.

Real audio signals are more concentrated near zeros. But human ear is more sensitive to quantization errors at small values.so that we should use non-uniform quantization.

Experience

In this lab, I design two program diagrams to two exercises to verify the principle of sampling and quantization and simulate the situation of sampling and quantization. And I try to compare the relationship between simulated SNR and the theoretical SNR to verify the success of the experiment. At the same time, I learnt hoe to apply the formula node to compute the output waveform and simulated SNR and the theoretical SNR. And we should avoid a kind of situation which is the frequency impulse signal is special multiple of the frequency of the original signal which will cause that the point we sample are all zeros. So, when we look at the output figure, we get nothing. By comparing the simulated SNR and the theoretical SNR, we can find when we increase 1 bit, the SNR will increase 6dB.

Score