### Lab 4

• Part 1.2, 1.3: Use equation (6) for building time signals x(t). Recall that built-in function exp() operates element-wise over vectors, so you do not need to use a for. Use equation (5) and function dft() provided to compute the CTFT (Continuous Time Fourier Transform). When plotting a complex function, always plot either real and imaginary part, or absolute and argument values. Plotting only one might not show you all the information.
• Part 2.1: Record your voice into your vector as in Lab 3, Part 2.1. Perform dft() on your voice vector x. Plot it (real and imaginary, or absolute and argument) to observe that values for f>4kHz are close to null. Create a function that takes as input the DFT X, the sampling frequency fs, and the cutoff frequency f0 and returns a vector of frequency component X_BL such that all frequencies above f0 are set to zero. Perform idft() on this new frequency vector, and play the resulting signal (remember that there might be some numeric errors leading to an imaginary time signal; apply real() before playing it). Observation: Here you will have to record your voice and your partner’s. It would be a good practice to record the same duration, so that both vectors have the same length.
• Part 2.2: Create a function that takes the bandlimited time signal, the carrier frequency fc and the sampling frequency fs and modulates it according to eq. (10). Function cexpt() provided might come in handy.
• Part 2.3, 2.4: Create a similar function but that modulates with a cosine function instead of a complex exponential (that is, using equation (12) instead of (10)). Recall that you can obtain a cosine from taking the real part of a complex exponential (provided by cexpt()). Check the amplitude of the modulated frequency components with respect to the original signal.
• Part 2.5: Write a function that demodulates a bandlimited signal. The inputs should be the bandlimited high-frequency signal, the carrier frequency of that signal fc, and the sampling frequency fs. Think of this as the inverse procedure of the previous problem. The conversion to bandlimited signal done in Part 2.1 might come in handy. Observation: Before applying the filter in part 2.1 check if the demodulated frequency components and the original frequency components (before modulation) are the same (especially in amplitude).

### Lab 5

• Part 2.2: In order to build a subsampling function, there are some built-in functions like downsample() or upsample() that might come in handy. Check them out. Be careful on rescaling the time axis which should also be one of your outputs. You might find it useful to check first that the function works by using more tractable signals than the gaussian pulse. Observation: When needed, plot the absolute value of the DFT of the gaussian pulse.
• Part 2.3: Repeat part 2.2 for different values of sigma in {100ms, 10ms, 1ms, 0.5ms, 0.1ms, 0.05ms}, compare the DFTs of x_delta and the original x. Remember to set the x axis to be frequencies.
• Parts 2.4, 2.5: The function that you designed in the lab 4 for filtering your voice signal (before modulation) might come in handy. One such implementation is provided in this page under the name of lpf_freq(). Remember to read the help info before using it.
• Part 2.6: Low pass filter the DFT of x_delta using lpf_freq() and use idft() for reconstruction on the output of the LPF.

### Lab 6

• Part 1: Use record_sound() function provided. Read help before using. For playing sounds, use sound(). Read help before using. Once you have recorded your sounds, it is wise to save the workspace so you do not have to record them each time you try to solve the lab. It might be useful to store recordings in matrix form, where each column is one recorded sample. For operation, you can use a for extracting each column of the matrix, or you can think in terms of matrix algebra. For storing the DFTs you can also do that in a matrix. Observation: It might be useful to create a separate script or function that allows you to record several times.
• Part 2: Explore the function mean(). Take into account the dimensionality DIM input of mean. Test it with a simple matrix you know the results of averaging before you use it to be sure you are averaging in the correct dimension.
• Parts 3, 4: Think how you can use matrix multiplication to avoid for loops when calculating the inner product. Functions max() and ismember() can be helpful.

### Lab 7

• Part 1: It is stated in the Lab that the output of a filter can be obtained as the product of two Fourier transforms. What does that imply in the time domain? Google how to implement this operation in Matlab.
• Part 2: Write down the equation of the operation carried out in 1 and analyze it in time, sample by sample. What can you take from that?
• Part 2: One way to do this is by using the Matlab function audiorecorder. Look at the options TimerFcn and TimerPeriod of the audiorecorder function in MATLAB. That with getaudiodata will get you to perform the operations online. Instead, you can also record a sequence of test samples in a single audio file (e.g. “One-Two-One-One”), and process them as if they were coming in one at a time.