Kurt's Assignment: Difference between revisions

From Class Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
<math>\begin{align}
<math>\begin{align}
x(t) &= x(t+T) = a_0 + \sum_{n=1}^\infty a_n \cos(n\omega_0t) + b_n \sin(n\omega_0t)\\
x(t) &= x(t+T) = a_0 + \sum_{n=1}^\infty a_n \cos(n\omega_0t) + b_n \sin(n\omega_0t)\\
a_0 &= \frac{1}{T}\int_0^T f(t) dt\\
a_0 &= \frac{1}{T}\int_0^T f(t)\, dt\\
a_n &= \frac{2}{T}\int_0^T f(t)\cos(n\omega_0t) dt\\
a_n &= \frac{2}{T}\int_0^T f(t)\cos(n\omega_0t)\, dt\\
b_n &= \frac{2}{T}\int_0^T f(t)\sin(n\omega_0t) dt\\
b_n &= \frac{2}{T}\int_0^T f(t)\sin(n\omega_0t)\, dt\\
\end{align}
\end{align}
</math>
</math>
Line 17: Line 17:


<math>\begin{align}
<math>\begin{align}
a_0 &= \frac{1}{T}\int_0^{\frac{1}{2}T} H dt + \frac{1}{T}\int_{\frac{1}{2}T}^T -H dt\\
a_0 &= \frac{1}{T}\int_0^{\frac{1}{2}T} H\, dt + \frac{1}{T}\int_{\frac{1}{2}T}^T -H\, dt\\
&=\frac{1}{T}\left[Ht\right]\bigg|_{t=0}^{\frac{1}{2}T} - \frac{1}{T}\left[Ht\right]\bigg|_{t={\frac{1}{2}T}}^T\\
&=\frac{1}{T}\left[Ht\right]\bigg|_{t=0}^{\frac{1}{2}T} - \frac{1}{T}\left[Ht\right]\bigg|_{t={\frac{1}{2}T}}^T\\
&=\frac{1}{T}H\frac{1}{2}T-0 - \left[\frac{1}{T}HT - \frac{1}{T}H\frac{1}{2}T\right]\\
&=\frac{1}{T}H\frac{1}{2}T-0 - \left[\frac{1}{T}HT - \frac{1}{T}H\frac{1}{2}T\right]\\
Line 27: Line 27:


<math>\begin{align}
<math>\begin{align}
a_n &= \frac{2}{T}\int_0^{\frac{1}{2}T} H\cos(n\omega_0t) dt + \frac{2}{T}\int_{\frac{1}{2}T}^T -H\cos(n\omega_0t) dt\\
a_n &= \frac{2}{T}\int_0^{\frac{1}{2}T} H\cos(n\omega_0t)\, dt + \frac{2}{T}\int_{\frac{1}{2}T}^T -H\cos(n\omega_0t)\, dt\\
&=\frac{2}{T}\left[\frac{H}{n\omega_0}\sin(n\omega_0t)\right]_0^{\frac{1}{2}T} + \frac{2}{T}\left[\frac{-H}{n\omega_0}\sin\left(n\omega_0t\right)\right]_{\frac{1}{2}T}^T\\
&=\frac{2}{T}\left[\frac{H}{n\omega_0}\sin(n\omega_0t)\right]_0^{\frac{1}{2}T} + \frac{2}{T}\left[\frac{-H}{n\omega_0}\sin\left(n\omega_0t\right)\right]_{\frac{1}{2}T}^T\\
&=\frac{2}{T}\left[\frac{H}{n\frac{2\pi}{T}}\sin\left(n\frac{2\pi}{T}\frac{1}{2}T\right)-0\right] + \frac{2}{T}\left[-0+\frac{H}{n\frac{2\pi}{T}}\sin\left(n\frac{2pi}{T}\frac{1}{2}T\right)\right]\\
&=\frac{2}{T}\left[\frac{H}{n\frac{2\pi}{T}}\sin\left(n\frac{2\pi}{T}\frac{1}{2}T\right)-0\right] + \frac{2}{T}\left[-0+\frac{H}{n\frac{2\pi}{T}}\sin\left(n\frac{2pi}{T}\frac{1}{2}T\right)\right]\\
Line 38: Line 38:


<math>\begin{align}
<math>\begin{align}
b_n &= \frac{2}{T}\int_0^{\frac{1}{2}T} H\sin(n\omega_0t) dt + \frac{2}{T}\int_{\frac{1}{2}T}^T -H\sin(n\omega_0t) dt\\
b_n &= \frac{2}{T}\int_0^{\frac{1}{2}T} H\sin(n\omega_0t)\, dt + \frac{2}{T}\int_{\frac{1}{2}T}^T -H\sin(n\omega_0t)\, dt\\
&=\frac{2}{T}\left[\frac{-H}{n\omega_0}\cos(n\omega_0t)\right]_0^{\frac{1}{2}T} + \frac{2}{T}\left[\frac{H}{n\omega_0}\cos(n\omega_0t)\right]_{\frac{1}{2}T}^T\\
&=\frac{2}{T}\left[\frac{-H}{n\omega_0}\cos(n\omega_0t)\right]_0^{\frac{1}{2}T} + \frac{2}{T}\left[\frac{H}{n\omega_0}\cos(n\omega_0t)\right]_{\frac{1}{2}T}^T\\
&=\frac{2}{T}\left[-\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}\frac{1}{2}T)+\frac{H}{n\frac{2\pi}{T}}\right] + \frac{2}{T}\left[\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}T)-\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}\frac{1}{2}T)\right]\\
&=\frac{2}{T}\left[-\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}\frac{1}{2}T)+\frac{H}{n\frac{2\pi}{T}}\right] + \frac{2}{T}\left[\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}T)-\frac{H}{n\frac{2\pi}{T}}\cos(n\frac{2\pi}{T}\frac{1}{2}T)\right]\\
Line 53: Line 53:
===Triangle Wave===
===Triangle Wave===
Like the Square wave, the DC component of the Triangle Wave is 0 by inspection. Also, since the triangle wave is odd, it is made up only by sine components.
Like the Square wave, the DC component of the Triangle Wave is 0 by inspection. Also, since the triangle wave is odd, it is made up only by sine components.

<math>\begin{align}
a_0 &= \frac{1}{T}\int_{-\frac{1}{4}T}^{\frac{1}{4}T}\frac{4H}{T}t \,dt +

\end{align}</math>




Line 60: Line 65:
====Square Wave====
====Square Wave====
clf; %Clear Figure
clf; %Clear Figure
t=0:.01:10; %Limits of the graph
t=0:.01:10; %Limits of the graph
T=2*pi %Definition of the period
T=2*pi %Definition of the period
M=100 %Number of iterations to undergo
M=100 %Number of iterations to undergo
sum1=0; %Initialize the sum to <br>
sum1=0; %Initialize the sum to <br>
%----------FOURIER SERIES----------%
%----------FOURIER SERIES----------%
for m=1:1:M, %For m=1, increment by 1 until you get to M
for m=1:1:M, %For m=1, increment by 1 until you get to M

Revision as of 17:54, 1 November 2010

Common Synthesizer Waveforms

Many synthesizers employ a variety of waveforms to produce varied sounds. The most common waveform is the sine wave. However, in additive synthesis, multiple waveforms can be added together to create a different waveform with different characteristics. The basis for this form of synthesis is the Fourier series:


The four basic waveforms are Sine Waves, Square Waves, Triangle Waves, and Sawtooth Waves.

Square Wave

By inspection of the waveform, the DC component of the wave will be 0. Also, since the waveform is odd, an will be 0. Here is the proof:



This just leaves the sine component of the waveform found below.


Finally, resulting in the Fourier series for a Square Wave.

Triangle Wave

Like the Square wave, the DC component of the Triangle Wave is 0 by inspection. Also, since the triangle wave is odd, it is made up only by sine components.


Sawtooth Wave

OCTAVE Scripts to Plot Fourier Series

Square Wave

clf;            %Clear Figure
t=0:.01:10;     %Limits of the graph
T=2*pi          %Definition of the period
M=100           %Number of iterations to undergo
sum1=0;         %Initialize the sum to 
%----------FOURIER SERIES----------% for m=1:1:M, %For m=1, increment by 1 until you get to M if(m!=0) sum1 = sum1 + ((2/(pi*m))-(2/(pi*m))*cos(m*pi))*sin(m*2*pi/T*t); end end
%---------------PLOT---------------% plot(t,real(sum1),'b-') title('Fourier Series Representation of a Wave') xlabel('time (seconds)') ylabel('Function') grid on;
legend(num2str(M) ' terms'); print("squarewave.png","-dpng")  % Prints the plot to a png file called squarewave.png