title: How to remove the quantization noise from a given quantized signal?
body: <p>Say, I have an analog signal and it's discrete representation:</p>
  
  <p><img src="https://i.stack.imgur.com/77O07.png" alt="enter image description here"></p>
  
  <pre><code>import numpy as np
  import pylab as py
  
  def sin(frequency = 1, time = 1, sampling = 128, phi = 0):
      '''
      Sinus function for a given frequency in Hz, length in time,
      sampling frequency, and phase.
      '''
      dt = 1.0 / sampling
      t = np.arange(0, time, dt)
      s = np.sin((2 * np.pi * frequency * t) + phi)
      return s, t
  
  s_analog_1, t_analog_1 = sin(frequency = 1, sampling = 1000)
  py.plot(t_analog_1, s_analog_1, linewidth = '1.5', color = 'red', 
  label = 'analog signal')
  
  s_analog_2, t_analog_2 = sin(frequency = 1, sampling = 10)
  py.plot(t_analog_2, s_analog_2, 'o', color = 'red')
  
  # Calculate the quantization noise, ie "R/2^N"
  s_discrete, t_discrete = sin(frequency = 1, sampling = 10)
  N = 3
  R = 2
  dy = R/2**N
  s_quantized = np.floor(s_discrete / dy) * dy + 0.5 *dy
  
  py.plot(t_discrete, s_quantized, color = 'gray', label = 'discrete signal')
  py.plot(t_discrete, s_quantized, 'o', color = 'gray')
  
  py.legend(loc='upper right', fontsize='10')
  
  py.show()
  </code></pre>
  
  <p>Analog to Digital Converter is 3 bit level and it's measure range is 2. How can I remove the quntized noise from the discrete signal representation so it will fit the analog signal representation? The question is asked in the context of situation, when I have already gathered discrete signal. In the removal process I can use the quantization noise coefficient, i.e <code>dy = R/2^N</code>. Thank you in advance.</p>