# Week 1 Homework a. Using Octave, prepare and test a set of programming statements to generate two di

Week 1 Homework

a. Using Octave, prepare and test a set of programming statements to generate two different Sinewaves (x1(n) and x2(n)).

b. Process these two sinewaves through a linear system with the following definition:

y(n) = (-3*x(n))/8;

Show, through example, that for your two Sinewaves, the result of processing the sum of your two sinewaves, x1(n) + x2(n) by the linear system y(n) is the same output as the sum of the two outputs, y applied to x1(n) added to y applied to x2(n).

You should provide plots of x1, x2, and x1+x2. In addition you should provide plots of y1, (i.e., y applied to x1) and y2 (y applied to x2). Finally, you should show in a plot that y1+y2 is the same as y(x1+x2).

You are welcome to generate different sinewaves using different sample rates or oscillations but the net result should show that your system is linear.

**Explain** why your system is a linear system.

c. Prepare a block diagram for time-invariant linear system that performs a 5-point moving average. Using Octave, then prepare and test an Impulse response that tests your 5-point moving average system. Plot both the input and the output for the Impulse and the attached dataset (for5avg.m).

Deliverables: You should include a separate Octave m file for each of the problems for this set. Name one yournamehw1a.m and the other yournamehw1b.m. These m files should be fully tested and run perfectly from start to finish. The m files will include the plotting routines but you should also include a word document that includes your output, explanations, block diagram and other information from both parts of this assignment. If you prefer to use LaTeX, a freely downloadable tool that many researchers prefer to Word, you are welcome to do so, so long as you send me the .pdf output.

Your plots should be neat, properly labeled, with axis information, legends and titles as appropriate. Your code (m file) should include inline comments that describe your code and include header information including author, date and descriptions. Your word document should be named yournamehw1.doc (or yournamehw1.docx)

Be sure to submit your homework in the WebTycho assignments folder no later than the due date listed in the syllabus.

Rubric:

a. Show that you know what it takes to specify a sinewave. At a minimum, it has a frequency. Sinusoids also have amplitude and phase. For 33 points, set each component. For 25 points, any two sinewaves are enough. For 12 points, show the mathematical expression, naming the Octave function that calculates sine.

b. For 33 points, explain mathematically what the plots show, namely, the given transformation y=f(x) is a linear one. For 25 points, show the plots without the convincing argument. For 12 points, find a definition of linear transformation and write it (with citation).

c. For 33 points, the whole. For 25 points, write down the definition of moving average, and discuss why a programmatic loop could be useful. For 12 points, write down the definition of average, and of impulse function