Page MenuHomec4science

2_analysis.tex
No OneTemporary

File Metadata

Created
Thu, Mar 13, 16:59

2_analysis.tex

\documentclass[aspectratio=169]{beamer}
\def\stylepath{../styles}
\usepackage{\stylepath/com303}
\begin{document}
\begin{frame}
\frametitle{Overview}
\begin{itemize}
\item DFT analysis examples
\item Labeling the DFT axes
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Mystery signal revisited}
\begin{center}
\begin{figure}
\begin{dspPlot}[yticks=2,xout=true]{0, 1023}{-3, 3}
\moocStyle
\dspFunc{x 1024 div 360 mul 64 mul cos rand 2147483647 div 0.5 sub 2 mul add}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
% mystery signal revisited
\begin{frame}
\frametitle{Mystery signal revisited}
\begin{center}
\begin{figure}
\begin{dspPlot}[yticks=500,xticks=256,xout=true,width=8cm,height=2.5cm,ylabel={Re}]{0, 1023}{-100,600}
\moocStyle
\dspFuncFile{mysteryDFTRe.txt}
\only<2>{
\pscircle[linecolor=blue,linewidth=0.5pt](64,493){5pt}
\uput{1em}[0](64,493){$k=64$}
\pscircle[linecolor=blue,linewidth=0.5pt](960,493){5pt}
\uput{1em}[180](960,493){$k=960$}}
\end{dspPlot}
\end{figure}
\vspace{-1em}
\begin{figure}
\begin{dspPlot}[xticks=256,xout=true,width=8cm,height=2.5cm,ylabel={Im}]{0, 1023}{-100,600}
\moocStyle
\dspFuncFile{mysteryDFTIm.txt}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Mystery signal revisited}
\centering
\[
x[n] = \cos (\omega n + \phi) + \eta[n]
\]
\pause
with
\[
\begin{array}{rl}
\phi &= 0 \\
\omega &= \displaystyle\frac{2\pi}{1024}64
\end{array}
\]
\end{frame}
\begin{frame}
\frametitle{Mystery signal unveiled}
\begin{center}
\begin{figure}
\begin{dspPlot}[xticks=256,yticks=2,width=8cm,height=2.5cm,xout=true]{0, 1023}{-1.2, 1.2}
\moocStyle
\def\dspPSPoints{4000}
\dspFunc{x 1024 div 360 mul 64 mul cos }
\end{dspPlot}
\end{figure}
\vspace{-1em}
\begin{figure}
\begin{dspPlot}[xticks=256,yticks=2,width=8cm,height=2.5cm,xout=true]{0, 1023}{-1.2, 1.2}
\moocStyle
\dspFunc{rand 2147483647 div 0.5 sub 2 mul }
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
% solar spots
\begin{frame}
\frametitle{Solar spots}
\begin{itemize}[<+->]
\item sunspot number: $s = 10 \times \mbox{\# of clusters} + \mbox{\# of spots}$
\item data set from 1749 to 2003, 2904 months
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Solar spots}
\begin{center}
\begin{figure}
\begin{dspPlot}[yticks=100]{1749, 2003}{0, 220}
\moocStyle
\dspFuncFile{solarspots.txt}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Solar spots}
\begin{center}
\begin{figure}
\begin{dspPlot}[yticks=none,xticks=10]{0,100}{0, 0.5}
\moocStyle
\begin{dspClip}\dspFuncFile{solarspotsDFT.txt}\end{dspClip}
\only<2>{
\pscircle[linecolor=blue,linewidth=0.5pt](22,0.27){5pt}
\uput{1em}[0](22,0.27){main peak at $k=22$}}
\end{dspPlot}
\end{figure}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Solar spots}
\begin{itemize}[<+->]
\item DFT main peak for $k=22$
\item 22 cycles over 2904 months
\item period: $\displaystyle \frac{2904}{22} \approx 11 \mbox{ years}$
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Daily temperature (2920 days)}
\begin{center}
\begin{dspPlot}[xticks=custom,yticks=5,xout=true,xlabel={days},ylabel={$^\circ$C}]{0,303}{-10,35}
\moocStyle
\dspFuncData{0 14.39 1 11.44 2 14.56 3 19.89 4 16.72 5 15.11 6 23.11 7 24.11 8 22.50 9 27.17 10 26.61 11 23.61 12 23.50 13 20.50 14 17.33 15 19.50 16 15.33 17 18.39 18 13.83 19 7.78 20 19.06 21 4.56 22 10.56 23 16.67 24 -4.56 25 7.94 26 2.17 27 -3.17 28 6.67 29 4.61 30 -4.39 31 7.39 32 7.11 33 9.61 34 1.72 35 9.11 36 9.06 37 12.89 38 22.44 39 13.72 40 20.28 41 16.78 42 25.11 43 21.33 44 26.61 45 25.11 46 23.94 47 28.39 48 24.78 49 25.11 50 22.83 51 25.61 52 25.06 53 14.83 54 14.17 55 10.50 56 5.39 57 10.50 58 9.22 59 12.50 60 1.22 61 0.22 62 2.33 63 -5.11 64 -4.50 65 -0.44 66 -2.22 67 5.06 68 -0.50 69 -3.61 70 3.72 71 4.17 72 7.17 73 11.39 74 12.67 75 10.89 76 9.56 77 18.11 78 22.72 79 18.00 80 21.22 81 24.72 82 25.78 83 21.17 84 23.00 85 26.28 86 20.89 87 19.83 88 24.22 89 21.72 90 13.44 91 14.78 92 12.72 93 5.28 94 4.28 95 0.83 96 6.33 97 9.00 98 4.39 99 12.06 100 -4.56 101 -8.78 102 0.94 103 -1.00 104 0.83 105 3.50 106 8.11 107 5.11 108 5.89 109 9.72 110 20.83 111 14.56 112 22.17 113 18.94 114 21.72 115 20.61 116 18.22 117 18.17 118 23.00 119 27.44 120 25.44 121 24.89 122 23.67 123 24.06 124 24.22 125 20.39 126 16.61 127 15.56 128 18.44 129 7.00 130 10.89 131 7.11 132 4.83 133 2.56 134 -1.56 135 -0.56 136 -3.56 137 -0.33 138 2.22 139 4.28 140 -4.28 141 -4.00 142 -7.17 143 5.78 144 8.50 145 9.28 146 7.83 147 13.56 148 21.17 149 21.67 150 16.61 151 24.94 152 26.33 153 19.72 154 28.22 155 23.17 156 27.17 157 23.83 158 22.83 159 19.78 160 20.61 161 18.33 162 22.72 163 25.00 164 21.17 165 16.44 166 9.50 167 5.28 168 4.83 169 12.39 170 -1.17 171 0.28 172 1.44 173 1.39 174 -0.78 175 -1.78 176 0.39 177 -0.44 178 4.89 179 2.78 180 9.78 181 8.61 182 14.61 183 14.28 184 15.78 185 22.78 186 19.78 187 25.33 188 18.50 189 24.44 190 27.44 191 28.33 192 30.11 193 22.89 194 25.28 195 25.06 196 20.17 197 24.78 198 15.67 199 20.11 200 9.56 201 13.06 202 8.61 203 11.17 204 18.06 205 5.72 206 2.11 207 -0.33 208 0.83 209 -10.33 210 0.11 211 -6.89 212 -6.56 213 6.83 214 -2.50 215 5.06 216 4.56 217 10.44 218 10.00 219 5.28 220 11.00 221 13.06 222 16.61 223 13.17 224 17.33 225 27.17 226 19.28 227 23.72 228 28.89 229 25.39 230 27.22 231 29.17 232 22.78 233 19.50 234 20.33 235 21.17 236 17.39 237 6.22 238 10.06 239 7.83 240 5.06 241 4.61 242 2.83 243 -10.22 244 3.06 245 0.83 246 2.50 247 -2.89 248 6.78 249 -6.00 250 3.00 251 1.22 252 2.94 253 1.94 254 6.72 255 4.56 256 11.28 257 12.78 258 10.11 259 22.61 260 24.39 261 21.94 262 21.94 263 20.72 264 26.94 265 22.67 266 20.67 267 18.94 268 22.44 269 24.33 270 19.06 271 18.72 272 10.89 273 10.28 274 12.56 275 16.17 276 10.50 277 4.22 278 6.67 279 3.78 280 -6.94 281 -9.06 282 2.56 283 5.50 284 8.39 285 0.06 286 5.61 287 -2.83 288 -4.06 289 20.17 290 1.39 291 7.94}
\dspCustomTicks[axis=x]{0 0 50 500 100 1000 150 1500 200 2000 250 2500 300 3000}
\end{dspPlot}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Daily temperature: DFT}
\begin{center}
\begin{figure}
\begin{dspPlot}[yticks=4,xticks=custom,ylabel={$^\circ$C}]{0,50}{0, 13}
\moocStyle
\begin{dspClip}%
\dspFuncData{0 12.3 1 0.2 2 0.5 3 0.2 4 0.4 5 0.2 6 0.2 7 0.2 8 6.4 9 0.4 10 0.2 11 0.2 12 0.1 13 0.0 14 0.2 15 0.3 16 0.1 17 0.3 18 0.2 19 0.2 20 0.2 21 0.4 22 0.4 23 0.3 24 0.1 25 0.2 26 0.2 27 0.3 28 0.2 29 0.1 30 0.3 31 0.2 32 0.1 33 0.1 34 0.3 35 0.1 36 0.5 37 0.1 38 0.3 39 0.4 40 0.2 41 0.2 42 0.2 43 0.2 44 0.5 45 0.2 46 0.2 47 0.1 48 0.3 49 0.3 50 0.2 51 0.1 52 0.1 53 0.2 54 0.2 55 0.1 56 0.1 57 0.2 58 0.5 59 0.2 60 0.3 61 0.2 62 0.2 63 0.2 64 0.0 65 0.1 66 0.2 67 0.2 68 0.2 69 0.1 70 0.2 71 0.2 72 0.2 73 0.1 74 0.1 75 0.1 76 0.2 77 0.2 78 0.2 79 0.2 80 0.3 81 0.2 82 0.1 83 0.3 84 0.3 85 0.2 86 0.3 87 0.2 88 0.2 89 0.1 90 0.2 91 0.4 92 0.4 93 0.3 94 0.0 95 0.3 96 0.1 97 0.1 98 0.2 99 0.3 100 0.5 101 0.1 102 0.1 103 0.3 104 0.4 105 0.1 106 0.3 107 0.1 108 0.1 109 0.0 110 0.1 111 0.5 112 0.3 113 0.0 114 0.5 115 0.2 116 0.1 117 0.3 118 0.2 119 0.1 120 0.2 121 0.2 122 0.1 123 0.4 124 0.1 125 0.3 126 0.3 127 0.4 128 0.1 129 0.4 130 0.2 131 0.1 132 0.0 133 0.3 134 0.3 135 0.2 136 0.3 137 0.3 138 0.0 139 0.2 140 0.1 141 0.1 142 0.2 143 0.2 144 0.3 145 0.1 146 0.1 147 0.1 148 0.3 149 0.2 150 0.2 151 0.1 152 0.1 153 0.2 154 0.0 155 0.3 156 0.3 157 0.2 158 0.3 159 0.3 160 0.0 161 0.1 162 0.2 163 0.4 164 0.1 165 0.4 166 0.3 167 0.3 168 0.1 169 0.4 170 0.1 171 0.2 172 0.2 173 0.1 174 0.2 175 0.3 176 0.1 177 0.2 178 0.5 179 0.0 180 0.3 181 0.5 182 0.1 183 0.0 184 0.1 185 0.1 186 0.3 187 0.1 188 0.4 189 0.3 190 0.1 191 0.1 192 0.5 193 0.3 194 0.2 195 0.1 196 0.1 197 0.3 198 0.0 199 0.3 200 0.4 201 0.4 202 0.2 203 0.1 204 0.2 205 0.2 206 0.3 207 0.2 208 0.3 209 0.3 210 0.1 211 0.2 212 0.3 213 0.2 214 0.2 215 0.2 216 0.2 217 0.1 218 0.1 219 0.1 220 0.2 221 0.2 222 0.2 223 0.1 224 0.2 225 0.2 226 0.2 227 0.1 228 0.0 229 0.2 230 0.2 231 0.2 232 0.3 233 0.2 234 0.5 235 0.2 236 0.1 237 0.1 238 0.2 239 0.2 240 0.1 241 0.1 242 0.2 243 0.3 244 0.3 245 0.1 246 0.2 247 0.2 248 0.5 249 0.2 250 0.2 251 0.2 252 0.2 253 0.4 254 0.3 255 0.1 256 0.5 257 0.1 258 0.3 259 0.1 260 0.1 261 0.2 262 0.3 263 0.1 264 0.2 265 0.3 266 0.2 267 0.2 268 0.1 269 0.3 270 0.4 271 0.4 272 0.2 273 0.2 274 0.2 275 0.3 276 0.1 277 0.3 278 0.2 279 0.0 280 0.1 281 0.2 282 0.2 283 0.4 284 6.4 285 0.2 286 0.2 287 0.2 288 0.4 289 0.2 290 0.5 291 0.2}%
\end{dspClip}
\dspCustomTicks[axis=x]{0 0 50 500 100 1000 150 1500 200 2000 250 2500 300 3000}
\only<2->{
\pscircle[linecolor=green,linewidth=0.5pt](0,12.3){5pt}
\uput{1em}[0](0,12.3){avg temp $12.3^\circ$C}}
\only<3->{
\pscircle[linecolor=blue,linewidth=0.5pt](8,6.4){5pt}
\uput{1em}[0](8,6.4){peak at $k=8$}}
\end{dspPlot}
\end{figure}
first few hundred DFT coefficients\\ (in magnitude and normalized by the length of the temperature vector)
\end{center}
\end{frame}
\begin{frame}
\frametitle{Daily temperature}
\begin{itemize}
\item average value (0-th DFT coefficient): $12.3^\circ$C
\item DFT main peak for $k=8$, value $6.4^\circ$C
\item 8 cycles over 2920 days
\item period: $\displaystyle \frac{2920}{8} = 365 \mbox{ days}$
\item temperature excursion: $12.3^\circ\mbox{C} \pm 12.8^\circ$C
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Daily temperature}
\centering
In case you're wondering why $\pm 12.8^\circ$:
\vspace{2em}
\[
\DFT{A\cos\left(\frac{2\pi}{N}Mn\right)}[k] = \begin{cases}
\frac{A}{2}N & \mbox{for $k = M, N-M$} \\
0 & \mbox{otherwise}
\end{cases}
\]
\end{frame}
\begin{frame}
\frametitle{Labeling the frequency axis}
If we know the ``clock'' of the system $T_s$ (or its frequency $F_s$)
\begin{itemize}[<+->]
\item fastest (positive) frequency is $\omega=\pi$
\item sinusoid at $\omega=\pi$ needs two samples to do a full revolution
\item time between samples: $T_s = 1/F_s$ seconds
\item real-world period for fastest sinusoid: $2T_s$ seconds
\item real-world frequency for fastest sinusoid: $F_s/2$ Hz
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Example: train whistle}
\begin{center}
\includegraphics[height=60mm]{train.eps}
\movie[inlinesound]{\fbox{\small{Play}}}{train.wav}
\end{center}
\end{frame}
\def\dftpeak#1#2{%
\pscircle[linecolor=green,linewidth=0.5pt](#1){5pt}
\uput{1em}[0](#1){#2}}
\begin{frame}
\frametitle{Example: train whistle}
\centering
32768 samples (the ``clock'' of the system $F_s = 8000$Hz)
\begin{figure}
\begin{dspPlot}[xticks=custom,yticks=none,sidegap=0]{0, 1638}{0, 1.2}
\moocStyle
\dspFuncFile{trainDFT.txt}
\dspCustomTicks[axis=x]{0 0 1638 16384}
\only<2>{%
\dftpeak{198,0.79}{$k=2073$}
\dftpeak{229,1}{$k=2400$}
\dftpeak{292,0.56}{$k=3061$}}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Example: train whistle}
\centering
the ``clock'' of the system $F_s = 8000$Hz
\begin{figure}
\begin{dspPlot}[xticks=custom,yticks=none,sidegap=0]{0, 1638}{0, 1.2}
\moocStyle
\dspFuncFile{trainDFT.txt}
\dspCustomTicks[axis=x]{0 0 1638 4KHz}
\dftpeak{198,0.79}{506Hz}
\dftpeak{229,1}{585Hz}
\dftpeak{292,0.56}{747Hz}
\end{dspPlot}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Example: train whistle}
if we look up the frequencies:
\begin{center}
\includegraphics[height=30mm]{bminor.eps}
B minor chord
\end{center}
\end{frame}
\end{document}

Event Timeline