tag:blogger.com,1999:blog-5765846114256528572020-02-26T00:14:53.360-08:00Signal Processing & Digital CommunicationNinghttp://www.blogger.com/profile/10554144317471372456noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-576584611425652857.post-86612727924145566672019-11-03T20:43:00.000-08:002019-11-03T20:43:23.017-08:00Sampling theorem, communication The sampling theorem lays the very fundamentals of communication theory. It reveals the dimensionality of time & band-limited signal space, which in principle sets the limit on the rate of communication (or the capacity)<br /><br />Not only that, it also has its ultimate significance in the practical design of digital communication system, the concept of Inter-Symbol Interference (ISI)<br /><br /><h3>Nyquist criteria</h3>Suppose we'd like to transmit/modulate a sequence $\{a_0, a_1, ..., a_n\}$, the sampling theorem basically assures us that if we use the waveform of<br />\[ \sum a_n {\rm sinc}(t-n/2W) \]<br />and if the receiver knows exactly where to re-sample the waveform at the period of $1/2W$, the whole sequence could be recovered precisely (no noise presents). This is mainly because the sinc function has the following property:<br />\[ {\rm sinc}(t-n/2W) = \left\{ \begin{array}{lr}<br />1 & \mbox{, when } t=n/2W \\<br />0 & \mbox{, when } t \neq n/2W \\ \end{array} \right. \] <br />which often is referred as no ISI condition, or met the Nyquist criteria. The convolution kernel of ${\rm sinc}$ function here is usually referred as pulse shaping filter. <br /><br />We know that sinc function is not the only function to satisfy Nyquist criteria, for example, ${\rm sinc}({2Wt \over M}) $ where $M$ is integer do as well. However, in communication, they are not efficient enough (the data rate is reduced). If we picture the no ISI condition in frequency domain, it may be more insightful.<br /><br />The Fourier transform of ${\rm sinc}(2Wt)$ looks like:<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-tkJ940hAABs/Xb-a-FuO8sI/AAAAAAAAAfY/Jmsx7JhYr44oJsB3xln8m2XrstaDIv5rwCLcBGAsYHQ/s1600/blog2.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="595" data-original-width="1500" height="252" src="https://1.bp.blogspot.com/-tkJ940hAABs/Xb-a-FuO8sI/AAAAAAAAAfY/Jmsx7JhYr44oJsB3xln8m2XrstaDIv5rwCLcBGAsYHQ/s640/blog2.gif" width="640" /></a></div>and if we sample at $t=0, 1/2W,....n/2W$, the Fourier transform of the resulted sequence is:<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-PXRMjEIL0_U/Xb-bZW2RN-I/AAAAAAAAAfg/pq-k5gQMMxwQ59j5OVEJ1gsJgXNOtLJfQCLcBGAsYHQ/s1600/blog2_delta.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="635" data-original-width="1600" height="252" src="https://1.bp.blogspot.com/-PXRMjEIL0_U/Xb-bZW2RN-I/AAAAAAAAAfg/pq-k5gQMMxwQ59j5OVEJ1gsJgXNOtLJfQCLcBGAsYHQ/s640/blog2_delta.gif" width="640" /></a></div>which is the Fourier transform of impulse $\delta_n$. It means if we sample the waveform at the right timing, the whole chain (modulation & sampling) is just:<br />\[ a_n * \delta_n \]<br /><br />Now, if we allow the spectrum of $f(t)$ to be extended beyond W a bit, but put the constraint on the expansion that, after aliasing, the whole spectrum will be purely flat, it should satisfy the Nyquist criteria as well.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-M7TiKb042BM/Xb-ecCHBHYI/AAAAAAAAAfs/xGxWB1SI3g8QUsSOBgg3E-yxINx0XfKHQCLcBGAsYHQ/s1600/blog2_rc.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="649" data-original-width="1600" height="258" src="https://1.bp.blogspot.com/-M7TiKb042BM/Xb-ecCHBHYI/AAAAAAAAAfs/xGxWB1SI3g8QUsSOBgg3E-yxINx0XfKHQCLcBGAsYHQ/s640/blog2_rc.gif" width="640" /></a></div>One of the famous function has this property is raised cosine, which is the most commonly used pulse shaping filter in digital communication. Notice that in communication system, the shaping filter is usually divided into to two equal parts, one in transmitter and one in receiver, namely, root raised cosine filters. The rationale behind this separation is the matched filter theory, which can maximize the signal to noise ration (SNR) at sampling point. It also simplifies the analysis of the digital system, as the noise will be filtered by the matched filter and its power will be proportional to the nominal bandwidth W, thus the system performance will be independent of the rate.<br /><br /><br /><h3>Nyquist filter bank</h3>In signal processing, often we hear the name of Nyquist filter bank. It is the very same property (above) of the prototype filter gives the name. And it is this property make the synthesis extremely easy: just add all the samples from the filters together.<br /><br /><br /><br /><br />Ninghttp://www.blogger.com/profile/10554144317471372456noreply@blogger.com0tag:blogger.com,1999:blog-576584611425652857.post-17582615344957543742019-10-15T05:22:00.004-07:002019-10-15T05:23:41.738-07:00Singal Processing 101, Sampling Although often deemed as simple and easy to understand, Shannon's sampling theorem is absolute the most important pillar that underpins the whole modern digital world. It is never too much to emphasize this!<br /><br />Signal which is band limited by $W$ can be fully determined by discrete samples with interval less than $\frac{1}{2W}$ seconds:<br /><br />\[f(t)=\sum_{n=-\infty}^{+\infty}f({n \over 2W})\frac{\sin\pi(2Wt-n)}{\pi(2Wt-n)} \]<br /><br />This is the very bridge connects the math living your computer program to physical world ! The theory has quite a few interesting points worth to discuss. We will get them later, for now, let us get an impression of this ${\rm sinc}(2Wt)$ function. <br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-g8Q7EPa7Xmw/XaQNeuSsNiI/AAAAAAAAAcc/avIDJNGelWcG5AvGfLqWXzl24N8rtWWdQCEwYBhgL/s1600/sinc.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="640" height="240" src="https://1.bp.blogspot.com/-g8Q7EPa7Xmw/XaQNeuSsNiI/AAAAAAAAAcc/avIDJNGelWcG5AvGfLqWXzl24N8rtWWdQCEwYBhgL/s320/sinc.png" width="320" /></a></div>Two features of this function are very important<br />1. $h(n/2W) =0$ for $n \neq 0$ <br />2. Alternate sign of peaks, but decrease slowly.<br /><br /><h4>On ADC sampling rate</h4>Sampling theorem says if we align each sample at the peak, we can get full signal only if the signal change slow enough (bandwidth is less than W). In real application, it means if the ADC sampling rate is fast enough (at least 2W), the samples we get retain all the information of the signal. A natural question would be: whether sampling rate 2W would be enough ?<br /><br />Practically, the sampling rate should be strictly greater than 2W. There are two important factors limiting on how slow an ADC sampling rate can be. First, the anti-aliasing filter and Second, the latency / history we need to reproduce the signal.<br /><br />Suppose the signal is very clean and has nothing beyond W on the spectrum, and if the sampling rate is 2W, we have to use sinc(t) to reconstruct the signal. However, sinc(t) decays two slowly and in order to get a value accurately, we have to use large amount of previous and future samples, which typically becomes impractical.<br /><br />In addition, the analog anti-aliasing filter usually plays a more important role on selecting the sampling rate, as often, the signal is not clean enough, there are a lot of interference component on the spectrum beyond W. Following picture show the digital spectrum if there is only a second order Butterworth filter and the sampling rate is around 4W:<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-iEh-KUQG30o/XaRSm7NnytI/AAAAAAAAAck/t5S0aXqUoOErnVCYMyubuiPXuJSsidUWwCLcBGAsYHQ/s1600/spurs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="795" data-original-width="1600" height="158" src="https://1.bp.blogspot.com/-iEh-KUQG30o/XaRSm7NnytI/AAAAAAAAAck/t5S0aXqUoOErnVCYMyubuiPXuJSsidUWwCLcBGAsYHQ/s320/spurs.png" width="320" /></a></div>The second highest peak is the folded image component from a down converter which is at 22.7MHz, the sampling rate is 5MHz. <br /><br />The choice of analog filter depends a quite a lot of system constrains, like the phase linearity, stop band performance, pass band performance, and implementation cost etc. But choose the sampling rate to be at least 4W gives an octave of decay at the image frequency (sampling rate).<br /><br />Higher sampling rate will relax the requirement on analog anti-aliasing filter, and help to reduce the quantization noise, or equally, quantization levels (by oversampling and decimation). But chips start to be expensive beyond 1MHz. <br /><br /><div class="separator" style="clear: both; text-align: center;"></div><h4>On aliasing </h4>Sampling a continuous signal $f(t)$ at a cycle of 1/2W seconds means that the spectrum of $f(t)$, $\hat{f}(f)$ is repeated every 2W Hz. If $f(t)$ is band limited to W, it will look like this:<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-vYLqmzhr6rs/XaWpYtfeuVI/AAAAAAAAAcw/VEdYz3lDNpUS05pOLcs2M0p-EhaK33JwgCLcBGAsYHQ/s1600/blog1_noalias.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="79" data-original-width="283" src="https://1.bp.blogspot.com/-vYLqmzhr6rs/XaWpYtfeuVI/AAAAAAAAAcw/VEdYz3lDNpUS05pOLcs2M0p-EhaK33JwgCLcBGAsYHQ/s1600/blog1_noalias.jpg" /></a></div> However, if the spectrum of $f(t)$ exceeds W, it will look like<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-nude1SqkY1o/XaWp9luyceI/AAAAAAAAAc4/SidLFwzu6iYxrOALCjWlqZj7Nllj427VgCLcBGAsYHQ/s1600/blog1_alias.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="82" data-original-width="294" src="https://1.bp.blogspot.com/-nude1SqkY1o/XaWp9luyceI/AAAAAAAAAc4/SidLFwzu6iYxrOALCjWlqZj7Nllj427VgCLcBGAsYHQ/s1600/blog1_alias.jpg" /></a></div>as we can see, no matter what filtering is applied to the signal, there is no way to reverse the alias.<br /><br />As aforementioned, there might be a lot of interference on the spectrum along with the useful signal, e.g, image component of the mixer (frequency multiplier), 2nd order harmonics, and 3rd order harmonics, appropriate filtering will help to remove/attenuate these unwanted components, so that the digital spectrum is not polluted by aliasing.<br /><br />Following two figures shows how anti-aliasing filter affects the output of ADC<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-pFfR8biGVYA/XaWv6AoQncI/AAAAAAAAAdM/3UDs7Q27TB49U8QTq6JITiSf9oPMRgd5ACEwYBhgL/s1600/blog1_nofilter.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="437" data-original-width="661" height="262" src="https://1.bp.blogspot.com/-pFfR8biGVYA/XaWv6AoQncI/AAAAAAAAAdM/3UDs7Q27TB49U8QTq6JITiSf9oPMRgd5ACEwYBhgL/s400/blog1_nofilter.jpg" width="400" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-nG-Amgugikk/XaWwU7EWjhI/AAAAAAAAAdc/uoHWXyc0DO4NRpToZZVxfASEaIaP2XK1QCEwYBhgL/s1600/blog1_filter.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="435" data-original-width="657" height="263" src="https://1.bp.blogspot.com/-nG-Amgugikk/XaWwU7EWjhI/AAAAAAAAAdc/uoHWXyc0DO4NRpToZZVxfASEaIaP2XK1QCEwYBhgL/s400/blog1_filter.gif" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div>As we can see, ensure sufficient attenuation on interference/unwanted signal is key for a clean digital signal. Increase the sampling rate will relax the design constrains on this filter.<br /><br /><h4>On bandpass sampling</h4>Because of the spectrum of digital signal will repeat every 2W Hz, (cycle with 2W), sampling $\sin((2kW+\omega_0)t)$ with sampling rate 1/2W will produce the exact same data as sampling $\sin(\omega_0t)$. Above figure also illustrates this: the gray unwanted signal has a very high frequency, but after sampling, it ends at the position (on the spectrum) as if we sample a signal lower than the blue signal.<br /><br />This sparks a very interesting fact: for a narrow band passband signal, by carefully select the sampling rate, direct sampling the passband signal is the same as sampling the down converted signal. But direct sampling does not need the mixer and the low pass anti-aliasing filter. Instead a bandpass filter at higher frequency is required, which is easier and cheap to implement.<br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-xRUANlTi3Pk/XaW4CijJwUI/AAAAAAAAAd4/BkHLO3UI_2ADgIkHoUEN_WyNOVnHDcY6wCLcBGAsYHQ/s1600/blog1_bandpass.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="728" data-original-width="1100" height="263" src="https://1.bp.blogspot.com/-xRUANlTi3Pk/XaW4CijJwUI/AAAAAAAAAd4/BkHLO3UI_2ADgIkHoUEN_WyNOVnHDcY6wCLcBGAsYHQ/s400/blog1_bandpass.gif" width="400" /></a></div><br />Assignment: Use <a href="https://github.com/wnmusic/simpleFE">simpleFE</a> to build a bandpass sampling example. <br /><br /><br />Ninghttp://www.blogger.com/profile/10554144317471372456noreply@blogger.com0