Page MenuHomec4science

3_modulation.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 07:08

3_modulation.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com202}
\begin{document}
\begin{frame}
\frametitle{Overview:}
\begin{itemize}
\item Lowpass, highpass and bandpass signals
\item Sinusoidal modulation
\item Tuning a guitar
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame} \frametitle{Classifying signals in frequency}
Three broad categories according to where most of the spectral energy resides:
\begin{itemize}
\item lowpass signals (also known as ``baseband'' signals)
\item highpass signals
\item bandpass signals
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Lowpass example}
\begin{center}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,yticks=none,ylabel={$|X(e^{j\omega})|$}]{-1,1}{0, 1.5}
\moocStyle
\dspFunc{x \dspPorkpie{0}{.1}}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Highpass example}
\begin{center}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,yticks=none,ylabel={$|X(e^{j\omega})|$}]{-1,1}{0, 1.5}
\moocStyle
\dspFunc{x 1 sub \dspPeriodize \dspPorkpie{0}{.1}}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Bandpass example}
\begin{center}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,yticks=none,ylabel={$|X(e^{j\omega})|$}]{-1,1}{0, 1.5}
\moocStyle
\dspFunc{x .5 sub \dspPeriod{0.5} \dspPorkpie{0}{.1}}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame} \frametitle{Sinusoidal modulation}
\begin{align*}
\DTFT{x[n] \cos(\omega_c n)} &= \pause \DTFT{\frac{1}{2} e^{j\omega_c n} x[n] + \frac{1}{2} e^{-j\omega_c n} x[n]} \\ \pause
&= \frac{1}{2}\left[ X(e^{j(\omega - \omega_c)}) + X(e^{j(\omega + \omega_c)}) \right]
\end{align*}
\pause
\begin{itemize}
\item usually $x[n]$ baseband
\item $\omega_c$ is the {\em carrier} frequency
\end{itemize}
\end{frame}
\def\wc{0.6 }
\def\sshape{\dspTri{0}{.1}}
\begin{frame} \frametitle{Example}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-1,1}{0, 1.5}
\moocStyle
\pnode(0,0){o} \pnode(\wc,0){a} \pnode(-\wc,0){b}
\only<1|handout:1>{\dspFunc{x \dspPeriodize \sshape}}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=darkred!60,linewidth=0.6pt,linestyle=dashed,xmin=-0.5,xmax=0.5]{x \dspPeriodize \sshape }}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=green!70]{x \wc sub \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{a}
\dspCustomTicks[axis=x]{{\wc} $\omega_c$}}
\only<3|handout:3>{
\dspFunc[linecolor=blue!50]{x \wc add \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{b}
\dspCustomTicks[axis=x]{{-\wc} $-\omega_c$}}
\only<4-|handout:4->{
\dspFunc[linecolor=orange]{x \wc sub \dspPeriodize \sshape x \wc add \dspPeriodize \sshape add 2 div }
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Again, explicitly showing the periodicity of the spectrum}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-4,4}{0,1.5}
\moocStyle
\pnode(0,0){o} \pnode(\wc,0){a} \pnode(-\wc,0){b}
\only<1|handout:1>{\dspFunc{x \dspPeriodize \sshape}}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=darkred!60,linewidth=0.6pt,linestyle=dashed]{x \dspPeriodize \sshape }}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=green!70]{x \wc sub \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{a}
\dspCustomTicks[axis=x]{{\wc} $\omega_c$}}
\only<3|handout:3>{
\dspFunc[linecolor=blue!50]{x \wc add \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{b}
\dspCustomTicks[axis=x]{{-\wc} $-\omega_c$}}
\only<4-|handout:4->{
\dspFunc[linecolor=orange]{x \wc sub \dspPeriodize \sshape x \wc add \dspPeriodize \sshape add 2 div }
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}}
\psframe[linecolor=lightgray,linewidth=0.4pt](-1,\dspMinY)(1,\dspMaxY)
\end{dspPlot}
\end{figure}
\end{frame}
\def\wc{0.93 }
\begin{frame} \frametitle{Careful when the modulation frequency is too large!}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-4,4}{0,1.5}
\moocStyle
\pnode(0,0){o} \pnode(\wc,0){a} \pnode(-\wc,0){b}
\only<1|handout:1>{\dspFunc{x \dspPeriodize \sshape}}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=darkred!60,linewidth=0.6pt,linestyle=dashed,]{x \dspPeriodize \sshape }}
\only<2-3|handout:2-3>{
\dspFunc[linecolor=green!70]{x \wc sub \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{a}
\dspCustomTicks[axis=x]{{\wc} $\omega_c$}}
\only<3|handout:3>{
\dspFunc[linecolor=blue!50]{x \wc add \dspPeriodize \sshape 2 div}
\nccurve[linewidth=0.4pt,linecolor=red,ncurv=1,angleB=-90,angleA=-90]{->}{o}{b}
\dspCustomTicks[axis=x]{{-\wc} $-\omega_c$}}
\only<4|handout:4>{
\dspFunc[linecolor=orange]{x \wc sub \dspPeriodize \sshape x \wc add \dspPeriodize \sshape add 2 div }
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}}
\psframe[linecolor=lightgray,linewidth=0.4pt](-1,\dspMinY)(1,\dspMaxY)
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Careful when the modulation frequency is too large!}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-1,1}{0,1.5}
\moocStyle
\pnode(0,0){o} \pnode(\wc,0){a} \pnode(-\wc,0){b}
\dspFunc[linecolor=orange]{x \wc sub \dspPeriodize \sshape x \wc add \dspPeriodize \sshape add 2 div }
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Sinusoidal modulation: applications}
\begin{itemize}
\item voice and music are lowpass signals
\item radio channels are bandpass, in much higher frequencies
\item modulation brings the baseband signal in the transmission band
\item demodulation at the receiver brings it back
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Sinusoidal demodulation}
\centering
just multiply the received signal by the carrier again
\pause
\[
y[n] = x[n] \cos(\omega_c n) \qquad Y(e^{j\omega}) = \frac{1}{2}\left[ X(e^{j(\omega - \omega_c)}) + X(e^{j(\omega + \omega_c)}) \right]
\]
\pause
\begin{align*}
\DTFT{y[n]\cdot 2 \cos(\omega_c n)} &= Y(e^{j(\omega - \omega_c)}) + Y(e^{j(\omega + \omega_c)}) \\ \pause
&= \frac{1}{2}\left[ X(e^{j(\omega - 2\omega_c)}) + X(e^{j(\omega)}) + X(e^{j(\omega)}) + X(e^{j(\omega + 2\omega_c)}) \right] \\ \pause
&= X(e^{j(\omega)}) + \frac{1}{2}\left[ X(e^{j(\omega - 2\omega_c)}) + X(e^{j(\omega + 2\omega_c)}) \right]
\end{align*}
\end{frame}
\def\wc{0.6 }
\def\modSpec{ dup \wc sub \dspPeriodize \sshape exch \wc add \dspPeriodize \sshape add 2 div }
\begin{frame} \frametitle{Demodulation in the frequency domain}
\centering
\only<1>{$\DTFT{x[n]}$}
\only<2>{$\DTFT{y[n]} = \DTFT{x[n]\cos\omega_c n}$}
\only<3->{$\DTFT{y[n]\, 2\cos\omega_c n}$}
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-4,4}{0,1.2}
\moocStyle
\pnode(\wc,0.6){a} \pnode(! \wc 2 mul 0.6){A}
\pnode(-\wc,0.6){b} \pnode(! \wc -2 mul 0.6){B}
\pnode(0,0.6){Z}
\only<1|handout:1>{\dspFunc{x \dspPeriodize \sshape }}
\only<2|handout:2>{\dspFunc[linecolor=orange]{x \modSpec }}
\only<3-4|handout:3-4>{
\dspFunc[linecolor=orange,linestyle=dashed,linewidth=0.6pt]{x \modSpec }
\dspFunc[linecolor=green!70]{x \wc sub \modSpec }}
\only<3|handout:3>{
\ncline[linewidth=1pt,linecolor=red]{->}{a}{A}\taput{$\omega_c$}
\ncline[linewidth=1pt,linecolor=red]{->}{b}{Z}\taput{$\omega_c$}
\dspCustomTicks[axis=x]{{\wc} $\omega_c$}}
\only<4|handout:4>{
\dspFunc[linecolor=green!70,linewidth=3pt,xmin=-0.5,xmax=0.5]{x \wc sub \modSpec }
\dspFunc[linecolor=blue!50]{x \wc add \modSpec }
\ncline[linewidth=1pt,linecolor=red]{->}{b}{B}\taput{$\omega_c$}
\ncline[linewidth=1pt,linecolor=red]{->}{a}{Z}\taput{$\omega_c$}}
\only<5-|handout:5->{
\dspFunc{x \wc sub \modSpec x \wc add \modSpec add }
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}}
\only<2-4|handout:2-4>{
\dspCustomTicks[axis=x]{{\wc} $\omega_c$ {-\wc} $-\omega_c$}}
\psframe[linecolor=lightgray,linewidth=0.4pt](-1,\dspMinY)(1,\dspMaxY)
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Demodulation in the frequency domain}
\centering
$\DTFT{y[n]\cos\omega_c n}$
\begin{figure}
\begin{dspPlot}[height=3cm,xtype=freq,xticks=1,yticks=none]{-1,1}{0,1.2}
\moocStyle
\dspFunc{x \wc sub \modSpec x \wc add \modSpec add }
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame} \frametitle{Demodulation in the frequency domain}
\begin{itemize}[<+->]
\item we recovered the baseband signal exactly...
\item but we have some spurious high-frequency components
\item in the next weeks we will learn how to get rid of them using \textit{filters}
\end{itemize}
\end{frame}
\begin{frame} \frametitle{Another application: tuning a guitar}
Problem (abstraction):
\begin{itemize}[<+->]
\item reference sinusoid at frequency $\omega_0$
\item tunable sinusoid of frequency $\omega$
\item make $\omega = \omega_0$ ``by ear''
\end{itemize}
\end{frame}
\begin{frame} \frametitle{The procedure}
\begin{enumerate}[<+->]
\item bring $\omega$ close to $\omega_0$ (easy)
\item when $\omega \approx \omega_0$ play both sinusoids together
\item trigonometry comes to the rescue: %\mbox{neglect the phase for simplicity}
\begin{align*}
x[n] &= \cos(\omega_0 n) + \cos(\omega n) \\
&= 2 \cos\left(\frac{\omega_0 + \omega}{2}n\right)\cos\left(\frac{\omega_0 - \omega}{2}n\right) \\
&\approx 2 \cos(\Delta_{\omega} n) \cos(\omega_0 n)
\end{align*}
\end{enumerate}
\end{frame}
\begin{frame} \frametitle{Let's see what's happening}
\[
x[n] \approx \only<1>{2\cos(\Delta_{\omega} n) \cos(\omega_0 n)}
\only<2->{\hlBox{t1}{green!30}{2\cos(\Delta_{\omega} n)} \cdot
\hlBox{t2}{blue!30}{\cos(\omega_0 n)}}
\]
\psset{linecolor=darkred}
\begin{itemize}
\item<2-> ``error'' \rnode[rc]{T1}{signal}
\item<3-> modulation at \rnode[rc]{T2}{$\omega_0$}
\item<4-> when $\omega \approx \omega_0$, the frequency of the error signal is too low to be heard; modulation brings it up to hearing range and we perceive it as amplitude oscillations of the carrier frequency
\end{itemize}
\only<2->{\nccurve[angleB=-75]{->}{T1}{t1}}
\only<3->{\nccurve[angleB=-75]{->}{T2}{t2}}
\end{frame}
\def\wc{0.2 }
\def\beat#1#2{\only<#1|handout:#1>{\dspFunc[plotpoints=5000]{x dup \wc 360 mul mul cos exch #2 360 mul mul cos add}}}
\def\blab#1#2{\only<#1|handout:#1>{\FPupn\d{\wc #2 - abs 0.5 * 4 trunc}%
$\omega_0 = 2\pi\cdot \wc,\quad \omega = 2\pi\cdot #2,\quad \Delta_{\omega} = 2\pi\cdot \d$}}
\begin{frame} \frametitle{In the time domain...}
\begin{center}
\begin{dspPlot}[xticks=100,xout=true]{0, 350}{-2.1,2.1}
\moocStyle
\beat{1-2}{0.22}
\only<2|handout:2>{\FPupn\d{\wc 0.22 - abs 0.5 * 4 trunc}\dspFunc[linewidth=6pt,linecolor=blue!20]{x \d0 360 mul mul cos 2 mul}}
\beat{3}{0.21}
\beat{4}{0.205}
\beat{5}{0.201}
%
\end{dspPlot}
\blab{1-2}{0.22}
\blab{3}{0.21}
\blab{4}{0.205}
\blab{5}{0.201}
\end{center}
\end{frame}
\cueCard{\href{https://github.com/prandoni/COM303/tree/master/FrequencyBeatings}{demonstration}}
\end{document}

Event Timeline