Home / Problem Set 3 / First Differences and Running Sums

First Differences and Running Sums

The questions below are due on Tuesday March 09, 2021; 10:45:00 PM.
 
You are not logged in.

If you are a current student, please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.csail.mit.edu) to authenticate, and then you will be redirected back to this page.

1) Derivatives

A crude approximation to differentiation on a discrete signal is a first difference:

y[n] = x[n] - x[n-1]

While there may be better means of approximating derivatives, this method is easy to implement and can work reasonably well in some scenarios.

1.1) In Time

Write a Python function that, when given one period of x[n] as a Python list, computes one period of y[n] using first differences. Note that your output list should be of the same length as the input list.

1.2) In Frequency

Write a Python function that, when given a Python list representing Fourier series coefficients X[k] for k=0,1,\ldots,N-1, computes the Fourier coefficients Y[k]. Note that your output list should be of the same length as the input list.

You should do this computation without converting back to the time domain.

2) Integrals

A crude approximation to integration on a discrete signal is a running sum:

y[n] = \sum_{i=-\infty}^n x[i]

Note that this signal is only finite-valued and periodic if X[0] = 0, i.e., if the original signal has no DC offset. We will make that assumption moving forward.

2.1) In Time

Write a Python function that, when given one period of x[n] as a Python list, computes one period of the approximate integral y[n] using a running sum. Note that your output list should be of the same length as the input list.

Hint: If X[0]=0, what can be said about the sum of the signal over a period?

2.2) In Frequency

Write a Python function that, when given a Python list representing Fourier series coefficients X[k] for k=0,1,\ldots,N-1, computes the Fourier coefficients of the approximate integral Y[k]. Note that your output list should be of the same length as the input list.

You should do this computation without converting back to the time domain.

Note that the value of Y[k] is not well defined for k=0; you should use 0 for that value (so that the output of the running sum has 0 DC offset).