Laboratory 7 - Frequency and Time Domain Operations
Aim
The aim of this lab is to get you familiar with signal processing in Matlab. If you have not have completed the lab exercises in lab 5, then do these first, especially the ones on plotting and numerical methods. These will help you prepare for the lab test next week. Then, try the exercises given below on signal processing.
Preparation
Go through the slides for lecture 20. This covers signal processing. As well, read chapter 14 of the textbook. Try out the examples covered in the lectures and the text book.
Tools
The only tool you will need is the matlab programming environment. To use this, you will need to logon to a computer in one of the Computer Science labs, open up a terminal window and type the following from the command line:
matlab
Instructions
Write matlab programs that perform the following tasks. Make sure that you save your answers in scripts. Run the scripts using the matlab tool.Exercise 1
You are given the following information:
- The number of samples is 40000, sampled over 2 seconds.
- The frequency of the signal is 261.6 Hz.
Compute the signal using the cos function over the
given sampling time. Plot the first 400 samples versus time (trying
to plot all of the values makes it too dense. Try it first).
Now, compute the FFT of this signal and plot this on the same plot. What is the value of the frequency that you get from the FFT? How accurate is it, compared to the actual signal frequency? What happens to this value when you increase the sampling time to 8 seconds and then to 12 seconds?
Now, add a 60Hz signal to the FFT that has 2/3 the amplitude of the original signal. Plot the new FFT. Compute the inverse transform and plot the composite signal.
Exercise 2
Using the composite signal generated above, do the following:
- Create a new signal that is composed of the first 0.2 sec of the composite signal, a period of 0.1 sec for which there is no signal, following by a signal that is made up of the last 0.15 sec of the composite signal, in reverse, with amplitude half that of the composite signal.
Plot the original signal and the new one on the same plot.
