Odd Exercise

Display the power spectrum of a square

1. Create a new VI using a template: NEW -> VI from template ->Tutorial (Getting Started) -> Generate, Analyze, and Display.

2. Choose a 10 Hz with a 50% duty cycle. Let's make it like a TTL clock - choose the , offset, etc to make the clock oscillate between 0 and +5 volts. Generate 500 samples, as fast as possible, at a rate of 1000 samples per second.

3. Set the parameters on the graphical indicator to your taste. You should be able to determine the period of the square wave, and the (0 volts and 5 volts) should be fairly evident. Run your VI - show it to your neighbor.

4. Add a Spectral Measurements VI to the block diagram - attach a graphical indicator to its output. Wire the 10 Hz square wave to the new spectral analyzer.

5. Measure the power spectrum in dB with no windowing. Adjust the graphical indicator to display the power spectrum from 0 Hz to 200 Hz - show amplitudes from +10 dB to -40 dB. Run your VI - show it to your neighbor.

Do you believe your spectrum plot?

6. Study the formula for the Fourier components of a square wave. Make a table - Fill Column 1 with the frequencies of the fundamental and the harmonics that you expect up to 200 Hz (Don't worry about DC for now).

7. Let's choose our 0 dB reference to be the fundamental. Calculate the expected amplitudes of the harmonics in dB ( This will yield "dB referenced to the fundamental"). Fill these into Column 2 of your table.

8. According to the formula, the peak value of the fundamental wave is the same as the square wave's peak amplitude. Since we have applied a DC offset equal to the peak amplitude of the square wave, we should have introduced a DC component with 0 dB relative to the fundamental. Add the DC component to your table of expected values.

9. Compare your table of expected values with the power spectrum produced by LabVIEW. Write a one (short) paragraph discussion of your results. Hand in your LabVIEW VI (front panel & block diagram), your table of expected results, and your discussion.

Extra Work:

1. Change the square wave to a triangle wave. How do the frequencies of the triangle wave harmonics compare with the square wave exercise? How about the amplitude? Are the triangle wave harmonics stronger or weaker than those of the square wave?

2. What is the frequency of your square wave's highest ? (trick question! - but recall that no transmission line is completely lossless - you can't pass ∞ Hz). Apply a low pass filter to your square wave - attenuate the upper end of the frequency spectrum that you are studying (say 100-200 Hz) Graph the results in the time domain and the frequency domain. You should get a qualitative indication of what happens to clock signals as they pass down a computer bus. What happened to your rise time? overshoot?