forked from Palakis/circles-sines-signals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sine_wave_properties.html
228 lines (193 loc) · 10 KB
/
sine_wave_properties.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<html>
<head>
<title>Circles Sines and Signals - Sine Wave Properties</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="third_party/d3/d3.min.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
jax: ["input/TeX","input/MathML","output/SVG"],
extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],
TeX: {
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
}
});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ TeX: { extensions: ["color.js"] }});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config(
{
SVG: {linebreaks: { automatic:true }},
displayAlign: "center"
}
);
</script>
<script type="text/javascript"
src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_SVG">
</script>
<link href='//fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Vollkorn:400italic,400' rel='stylesheet' type='text/css'>
<style>
@import url("fontello-b1d57784/css/fontello.css");
@import url("style.css");
</style>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-59785365-1', 'auto');
ga('send', 'pageview');
</script>
<link rel="icon" type="" href="favicon.ico"></head>
<body>
<div class="title">
<table width="900">
<tr>
<td width="90%">
<div class="bigheader" id="titleinfo">
</div>
</td>
</tr>
<tr>
<td width="70%">
<br/>
<div id="menu" class="menu" style="margin-left: 45; ">
<table> <tr id="menurow"> </tr> </table>
</div>
<!-- -->
</td>
</tr>
</table>
</div>
<div class="littleheader"> SINE WAVE ORTHOGONALITY
<div class="subheader" style="font-size: 14px"> SUITABILITY OF SINE WAVES AS COORDINATE BASES </div>
</div>
<script>
var SIMPLE_CORRELATION_OFFSET2 = 0.0;
var BASIS_FREQUENCY_1 = 1;
var BASIS_FREQUENCY_2 = 1;
function updateSimpleCorrelationOffset2(value) {
SIMPLE_CORRELATION_OFFSET2 = Math.PI * 2 * (value / 100);
}
function updateBasisFrequency1(value) {
BASIS_FREQUENCY_1 = value;
}
function updateBasisFrequency2(value) {
BASIS_FREQUENCY_2 = value;
}
</script>
<table class="figureTable">
<tr>
<td style="vertical-align: top;">
<div class="text" style="margin-left: 0px">
<p>
Discussing the Discrete Fourier Transform in terms of physical metaphors like “detectors” and “bins”, or even statistical notions like correlation is a bit disingenuous. In some sense, this style of discourse takes a bunch of fascinating mathematical relationships and reduces them to a set of constructions which are amenable to thought-by-analogy but are far less mathematically profound.<sup>1</sup> It’s probably better to recognize that <i>sine waves</i> possess a number of (sometimes stunning) properties which make them particularly well suited for use as the <i>bases</i> of a <i>coordinate system.</i>
I don’t want to thoroughly investigate coordinate systems and bases in this primer, but I’d like to provide you with some related visualizations which you generally will not find in the relevant literature.
</p>
<p>
<i>Orthogonality</i> is an important property for the basis vectors of a coordinate system. Two vectors (signals) are orthogonal to one another if their dot product is zero. Geometrically, when two vectors are orthogonal, they point at right angles to one another. The <i>natural</i> bases - the default bases for the Cartesian system - are orthogonal to one another. If we have a 3-Dimensional Cartesian system, the three natural basis vectors are,
</p>
<div style="font-family: lato; color: #333; padding-left: 20px; text-align: center">
<b>
[1, 0, 0]<br/>
[0, 1, 0]<br/>
[0, 0, 1]<br/>
</b>
</div><br/>
It’s easy to show that these vectors are orthogonal to one another. We can prove that by writing out all of the dot products, or simply by noticing that the dot product between any of the two vectors <i>must</i> be zero since every <span class="inlineexample">1</span> will be multiplied by a <span class="inlineexample">0</span>.
<p>
A bit more surprisingly, it can be shown that any two <i>sine waves</i> whose frequencies are multiples of one another are also orthogonal, <i>regardless of their phases</i>. This statement is a bit harder to mentally validate. You can take it on faith, or see a few examples before digging into a proof.
<i>Figure 1</i> allows you to compute the dot product between two sine and cosine pairs at different frequencies. Notice that the dot product is always zero unless the two waves are at the exact same frequency.
</p>
<br/>
<table>
<tr class="figureCaption">
<td width="100%">
<b>Figure 1.</b> Orthogonality of Sine and Cosine
</td>
</tr>
<tr>
<td>
<br/>
<svg id="sigCorrelationInteractiveSinCos" class="svgWithText" width="700" height="250" style="margin-left: 60px; padding: 0px;"></svg>
<script type="text/javascript" src="js/sine_orthogonality.js"></script><br/><br/>
<div class="controls" style="margin-top: 25px;">
<label id="phaseShift" for=simpleCorrelationOffsetTwo>Phase Shift</label><br/>
<input type=range min=0 max=100 value=0 id=simpleCorrelationOffsetTwo step=1 oninput="updateSimpleCorrelationOffset2(value);"
onMouseDown="" onMouseUp="" style="width: 150px"><br/>
<label id="upperFreq" for=frequencyBasisOne>Upper Frequency</label><br/>
<input type=range min=1 max=6 value=1 id=frequencyBasisOne step=1 oninput="updateBasisFrequency1(value);"
onMouseDown="" onMouseUp="" style="width: 150px"><br/>
<label id="lowerFreq" for=frequencyBasisTwo>Lower Frequency</label><br/>
<input type=range min=1 max=6 value=1 id=frequencyBasisTwo step=1 oninput="updateBasisFrequency2(value);"
onMouseDown="" onMouseUp="" style="width: 150px">
</div>
</td>
</tr>
</table>
</td>
<td class="figureExplanation" style="">
<br/><br/><br/><br/><br/>
<b>1.</b>
This is a bit of a non-sequitur since I know next to nothing about Douglas Hofstadter, but I really enjoyed <a href="http://youtu.be/n8m7lFQ3njk">his talk</a> titled "Analogy as the Core of Cognition".
</td>
</tr>
</table><br/>
<div class="littleheader"> SUMMING SINE WAVES
<div class="subheader" style="font-size: 14px"> ANOTHER CURIOUS PROPERTY </div>
</div>
<table class="figureTable">
<tr>
<td style="vertical-align: top;">
<div class="text" style="margin-left: 0px">
<p>
If we take two sine waves with the same frequency and sum them together, the result will always be a sine wave with the <i>exact</i> same frequency. This is a somewhat curious result, and it holds true even if the two sinusoids have completely different phases and amplitudes. <i>No other periodic signal possesses this property</i>. This means that we can take an infinite number of sine waves at a particular frequency, adjust their phases and amplitudes arbitrarily, sum them up, and still have a sine wave with the original frequency.
</p>
<p>
<i>Figure 2</i> demonstrates the summing of two sine-waves with equal frequency. You can use the sliders to adjust the phase and amplitude of the second sine wave. Notice that the frequency of the summation is always equal to the frequency of the two input sines.
</p>
<table>
<tr class="figureCaption">
<td width="100%">
<b>Figure 2.</b> Summing Sine Waves with Equal Frequency <br/>
</td><br/><br/>
</td>
</tr>
<tr>
<td>
<svg id="sineSummationInteractive" class="svgWithText" width="600" height="350" style="padding: 20px; margin-left: 70px;"></svg>
<script type="text/javascript" src="js/sine_summation.js"></script>
<script>
var SIMPLE_CORRELATION_OFFSET = 0.0;
function updateSimpleCorrelationOffset(value) {
SIMPLE_CORRELATION_OFFSET = Math.PI * 2 * (value / 100);
}
var SIMPLE_CORRELATION_AMP = 1.0;
function updateSimpleCorrelationAmp(value) {
SIMPLE_CORRELATION_AMP = value;
}
</script>
<div class="controls" width="400">
<label for=simpleCorrelationOffset>Phase Shift For Signal B</label><br/>
<input type=range min=0 max=100 value=0 id=simpleCorrelationOffset step=1 oninput="updateSimpleCorrelationOffset(value);"
onMouseDown="" onMouseUp="" style="width: 150px"><br/>
<label for=simpleCorrelationAmp>Amplitude of Signal B</label><br/>
<input type=range min=0 max=1 value=1 id=simpleCorrelationOffset step=0.1 oninput="updateSimpleCorrelationAmp(value);"
onMouseDown="" onMouseUp="" style="width: 150px">
</div>
</td>
</tr>
</table>
<br/>
<p>
Sine waves are utterly fascinating. Their peculiar nature makes them particularly well suited to act as the “atomic” components of complex signals. I’d encourage you to play around with sinusoids and the the trigonometric identities. Successful signal processing practice requires being somewhat intellectually intimate with sine waves. You'll constantly use them as test signals and ground-truths when writing and reasoning about signal processing algorithms.
</p>
</td>
<td class="figureExplanation" style="">
</td>
</tr>
</table><br/><br/>
<div class="title" id="footer"></div><script type="text/javascript" src="menu.js"></script></body>
</html>