OC3150 LAB 2


OBJECTIVE:

To compute Fourier Series amplitude coefficients for simple periodic wave forms.
 

PROCEDURE:
 

1. Change to your oc3150 directory and enter the Matlab environment.
 

2. Run the program "series":  >> series

This program plots 4 different waveforms (cosine, square, sawtooth, and triangle). It does the fft (fast Fourier series transform) on these signals and plots the Fourier amplitude coefficients. Before you begin plotting, the program will ask for your name and the name of a text file to which you can save results. The results that you select will be appended to the specified text file.

(a) Start by selecting the cosine wave. Choose an amplitude, mean value (offset), and phase shift.

(b) You will see a plot of a sinusoid with Period of 10 sec. Thus the fundamental frequency, f1 = 1/Period = 0.1 Hz and omega1 = 0.2(pi). The lower plot will be the Fourier amplitude coefficients plotted at integral multiples of f1; the mean is plotted at frequency = 0.  Since the input wave form is a simple sinusoid, you get only one amplitude coefficient at freq. = f1, and a mean value at freq. = 0.

(c) The first 10 amplitude coefficients, Amp, as well as frequency, an, and bn will be printed to the screen.   Note that the phase angle can be computed from tan-1(bn/an).

(d) The variance of the input signal is displayed as well. The variance of a simple sinusoid is Amp2/2.
 

3. Repeat the run for a cosine wave with a different mean value (same amplitude and phase angle as used above). Note that only the value at freq.=0 changes. The variance should remain the same.
 

4. Repeat for a different amplitude. The amplitude coefficient at freq.=f1 changes accordingly as well as the variance.
 

5. Repeat 4 for a different phase. No change occurs in the amplitude coefficients. Check the phase angle by computing it from the displayed values of an and bn.

Select and print out one page of cosine wave results to turn in with your lab report. Also, save the numerical results for the selected cosine wave to your output file.
 

6. Run series (one time each) for the other wave forms:

        square

        sawtooth

        triangle

These periodic wave forms are composed of an infinite number of sinusoids.  There is an amplitude coefficient for each sinusoidal component.   Save the numerical results so you can answer the questions below.

For your lab report, print out one set of plots for each type of waveform (i.e., a total of three additional pages, one page for each waveform type listed above).
 

7. Run program "reconstruct":   >> reconstruct
This program does an fft on the input signal,then reconstructs the signal using an inverse fft (ifft) but only uses the number of components you request. The maximum number of components is 64.

You do not need any plots or printout from this program.

(a) Start with the triangle wave. Begin with 2 or 3 components and work up.  Note that it requires only a few components to look very similar to the input signal.

(b) The square wave, however, needs all 64 components. Look at, for example, 1, 3, 7, 59, 61, and 63 components.

(c) Repeat for the sawtooth and cosine waves.
 

REPORT:

1. (a) For the three wave forms given in step 6, tabulate the first five components computed by series along with the expected analytical results (eg, a0 thru a4, b0 thru b4). You may already have formulas for the analytical amplitude coefficients calculated from your classroom exercises. Include the appropriate formulas with your listed results (Each formula should be expressed in general form; i.e., " an = ... " and " bn = ...". The formulas should be simplified as far as possible and should NOT have any integrals in them). If have not yet derived these expressions, you will need to do so and turn in the derivations with your report.   (b) How well do the amplitude coefficients computed for the square wave, triangle wave, and sawtooth wave compare with analytical results? Suggest reasons for any differences. 

2. Using the an and bn coefficients computed by series(for the square wave only) write the signal g(t) as a combination of sines and cosines (don't forget to include the a0 term).  You can stop after n = 3.  Write the frequencies as 2(pi)f rather than omega, substituting the appropriate value for f for each frequency component.

3. Repeat #2 using the Amplitude coefficients and the phase angles which you calculate based on the an and bn coefficients computed by series.

For your report, submit the answers to the above questions, the four pages with plots, and the corresponding contents of your series output file with the numerical results for each wave form.