## Description

ECE 444/644 : HW #3

1. Book problem 2.7-6.

2. Book problem 2.7-14. Use 20 dB of stopband

ripple.

3. Book problems 3.1-2(c,d,e) and 3.1-3(a,c).

4. Book problems 3.1-8 and 3.1-9.

5. Letting A and B designate the first two non-zero

least significant digits of your NDSU student ID,

define a T = 40 periodic signal x(t) as

x(t) =

0 −20 ≤ t < −(B + 10)

−t/(B + 10) −(B + 10) ≤ t < 0

2t/(A + 10) 0 ≤ t < A + 10

0 A + 10 ≤ t < 20

x(t + 40) ∀t

.

In this problem, you will implement a method

to output a periodic signal yK(t), the truncated Fourier series (FS) of the signal y(t) =

c1 + c2x(c3t). That is, output yK(t) as yK(t) =

PK

k=−K Yke

jkω0t

, where Yk are the FS coefficients of the signal y(t).

(a) Plot the signal x(t) over 2 periods.

(b) Determine constants c1 and c2 to maximize

the output amplitude range of yK(t) yet

provide some buffer against saturation and

clipping.

(c) Determine constant c3 so that yK(t) has

highest possible frequency yet maintains

adequate signal quality for 1 ≤ K ≤ 10.

(d) Derive the necessary Fourier series coefficients Yk. Create MATLAB plots of yK(t)

over 2 periods for 1 ≤ K ≤ 10.

(e) Devise an algorithm to output the desired

waveform on the K22F. Validate your algorithm with MATLAB code structured as

close as possible to your final C-code implementation. For example, while MATLAB

seamlessly supports complex numbers and

vector operations, C does not. Thus, represent complex numbers in your MATLAB

code using pairs of reals, and compute vector operations using explicit loops, just as

you would in C. Of course, if you can devise

a way so that you don’t need to use complex

numbers, that may be preferable…

(f) Create a project in Keil to output your designed waveform.

• Output yK(t) on the DAC channel at

a rate of one sample every 0.1 ms (10

kHz sampling rate).

• The number of terms K used in the

approximation yK(t) must be run-time

adjustable between 1 and 10. Adjust

the number of terms through button

presses (preferred method; one button

to increase, the other to decrease) or

watch-window (less preferred method).

• Turn on an LED when you enter the

ISR and turn the LED off when you

exit the ISR.

(g) To test your C program on the DSK, complete the following:

• Verify the output waveform shape for

each case using an oscilloscope. Most

oscilloscope’s in lab will calculate the

period, frequency, amplitude and other

information pertinent to a waveform

automatically. Use these feature to

appropriately measure your waveform.

How close are your waveforms to theoretical?

• Use an oscilloscope to measure the

LED “on-time”. What percentage of

the available processing time is being

used to generate your waveform? Does

the processing time vary with K?

To receive credit for this part of the assignment:

(a) Sign up to demonstrate your working hardware to the course instructor for check-off.

(b) Summarize your approach, findings, and

calculations in a short write-up.

(c) Attach a copy of your properly documented

C-code.