$30
we will construct signals and manipulate them via mathematical operations such as multiplication, addition and filtering. In order to construct a signal in Matlab, it is essential to generate a time vector by using the sampling period (T) which is given by T = 1/fs where fs is the sampling frequency. For example, for a duration of d seconds, a time vector can be generated in Matlab by dividing the duration of the signal into d/T equal pieces. Then, the signal can be generated by using this time vector.
For piecewise signals, firstly, each piece of the signal is constructed according to the defined time intervals. Afterwards, these pieces are concatenated.
In order to represent the signals in frequency domain, Fourier transform is employed. In Matlab, fft(x,N) function can be used to obtain the Discrete Fourier Transform (DFT) of a signal. This function returns the N-point DFT for the signal x. Similar to the construction of signals in time domain with time vectors as given above, frequency vectors should be generated to visualize the Fourier transforms of the signals in frequency domain. To generate frequency vectors in Matlab, you should divide the frequency range of the signal into N equal pieces. It is noteworthy that you must show the negative part of the frequency spectrum in your figures.
It is also useful to learn about the Matlab functions conv(.), zeros(.), ones(.), ifft(.), fftshift(.), abs(.), linspace(.) and length(.) by using Matlab Help before doing the labwork given below.
2 Labwork
Read the preliminaries given above carefully before doing the experiment given below.
2.1 Signals in Time Domain
a. Construct the signal x(t) which is defined in (1) and sampled with the sampling frequency fs = 500 Hz. The duration of x(t) is 4 s.
b.Plot x(t) where x-axis shows the time in seconds. Plotting without generating the whole x(t) signal will not be graded.
c. Construct the signal x2(t) = cos(2π50t) whose duration is the same as x(t). Then, generate the signal y1(t) = x(t)x2(t).
d. Plot y1(t) where x-axis shows the time in seconds.
2.2 Signals in Frequency Domain
a. Obtain the Fourier transforms of x(t) and y1(t) where the number of DFT points (N) is the length of the signal. Plot the magnitude of the frequency spectrum of x(t) and y1(t), i.e., |X(f)| and |Y (f)|, in the same figure using subplot() command.
Signals & Systems Review
b. Let x2(t) be the impulse response of a linear and time invariant system and x(t) be the input signal to this system as shown in Fig. 1. Obtain the output signal Y2(f) in frequency domain by only using the Fourier transforms of x2(t) and x(t). Plot |Y2(f)| where x-axis shows the frequency in Hz. Hint: You should reconfigure the size of the DFT operation for correct results.
y (t)
(t)
x 2
Figure 1: Block diagram of the linear and time invariant system.
c. Obtain y2(t) via inverse Fourier transform. Plot y2(t) where x-axis shows the time in seconds.
Obtain y2(t) via the convolution of x(t) and x2(t). Plot y2(t) where x-axis shows the time in seconds. Show that y2(t) which is obtained by convolution is the same as the signal obtained in