[Lui's homepage] [DSP homepage]
CE 101, 2nd Semester 2003-2004
Lab Exercise 2Digital Sinusoidal Oscillators
In this exercise you will use OpenOffice Spreadsheet to generate samples of sinusoids using a difference equation that acts as a digital sinusoidal oscillator. More information on these oscillators is provided [here].
1. First, use the pi( ) and sin( ) functions of OpenOffice Spreadsheet to generate samples of the analog signal
sin( 2 pi f1 t)
where f1 is the frequency assigned to you. [frequency assignments]. Use a sampling rate of 8000 Hz, and generate at least 200 samples starting at t = 0. Generate the samples on a single column of the spreadsheet. Identify the maximum sample values achieved from each cycle of the analog sinusoid. Write your name on all cells to the right of these local maximum values. Use an XY-Scatter graph [from the menu: Insert >> Chart ] to graph the resulting discrete-time signal against n on the horizontal scale.
2. Next, you are to generate samples of the function
0.25 sin( 2 pi f1 t)
using a difference equation. In this part of the exercise you are not supposed to use the pi( ) and sin( ) functions of the spreadsheet, except possibly to compute appropriate constant coefficients and initial conditions.
Use a difference equation of the form
y(n) = -a1 y(n-1) - a2 y(n-2)
with appropriate coefficients a1 and a2 and appropriate initial conditions y(-1) and y(-2). This difference equation specifies how the outputs y(n) may be obtained without the need for any input.
Use the same sampling rate of 8000 Hz, and generate at least 200 samples starting at t = 0. Generate the samples on a single column of the spreadsheet. Identify cells where the sample values go from positive or zero to negative in the next cell below it. Write your name on all cells to the right of these cells. Use an XY-Scatter graph [from the menu: Insert >> Chart] to graph the resulting discrete-time signal against n on the horizontal scale.
3. Obtain Q15 fixed point representations for each of the first 200 samples generated by the sinusoidal oscillator. Q15 is a signed 16-bit format, with each 16-bit number of the form
b15b14b13...b2b1b0
where each bj ( j = 0 .. 15) is either 0 or 1. The 16-bit number represents a number in the range [-1,1) given by
-b15 + b14*2-1 + b13*2-2 + ... + b2*2-13 + b1 * 2-14 + b0* 2-15 .
Thus, 0000 0000 0000 0000 represents 0;
0000 0000 0000 0001 represents 2-15;
0100 0000 0000 0000 represents 0.5;
1000 0000 0000 0000 represents -1;
1100 0000 0000 0000 represents -0.5;
1110 0000 0000 0000 represents -0.25;
1111 1111 1111 1111 represents -2-15.
Be able to answer all questions related to this exercise. During evaluation of this exercise, you must have with you on files or on paper any and all forms of documentation that you would need to show and/or discuss how you went about doing this exercise.
[Lui's homepage] [DSP homepage]
This page has been accessed
times since December 6, 2003.