HW1#3a) Let y1[n] = cos( pi/2*n) , y2[n] = cos( 4pi/5*n) . What are their
fundamental periods? Plot two periods of
y1[n] and y2[n] in Matlab and clearly mark the end of each period.
>> n = -4:1:4;
>> y1 = cos( pi/2 * n);
>> stem(n, y1);
>> n = -5:1:5;
>> y2 = cos (4*pi/5*n);
>> stem(n, y2);
HW1#3b) Determine the fundamental period of the signal z[n] = y1[n] + y2[n] .
Plot two periods of z[n] in
Matlab and clearly mark the end of each period.
(b)
>> n = -20:1:20;
>> y1 = cos( pi/2 * n); y2 = cos (4*pi/5*n);
>> z = y1 + y2; stem(n, z);
HW1 Problem 7 (Matlab and convolution with exponentials)
Most of the homeworks will have a major component in Matlab. For this problem,
you will use Matlab's
'conv' function to convolve exponentials. You can type 'help conv' in Matlab for
help on using the
function. For the following, plot h(t) and x(t) on the domain [¡2; 2] with :01
between points. Then
plot the resulting convolution. To create the time axis, you can use, for
example, 't = [-2:0.01:2]'. If the
Matlab exercises in this homework require a lot of e®ort, you should go through
a tutorial on Matlab.
Don't forget to submit code with the plots.
(a) h(t) = e^-t*u(t)
x(t) = u(t)
7(a)
>> t = [-2: 0.01: 2];
>> u = [ zeros(1, 200) ones(1, 201) ];
>> h = exp(-t) .* u;
>> y7a = conv( h, u); plot([-4:0.01:4], y7a);
>> subplot(3,1,1), plot(t, h);
>> subplot(3,1,2), plot(t, u);
>> subplot(3,1,3), plot([-4:0.01:4], y7a);
HW1 Problem 7(b) h(t) = e^-t*u(t)
x(t) = e^-2t*u(t)
7(b)
>> x = exp(-2*t) .* u; y7b = conv( h, x);
>> subplot(3,1,3), plot([-4:0.01:4], y7b);
>> subplot(3,1,1), plot(t, h);
>> subplot(3,1,2), plot(t, x);
Problem 8 (Matlab and discrete time Fourier Transform)
Recall that for a discrete signal x[n] , the discrete time Fourier Transform (DTFT)
is given by X(w) =
E(from k=-inf to inf)x[n]e^-(jwn) . We will cover the DTFT in detail this
semester, but you should be able to find the
transforms of the following signals through your knowledge from EE 20. In the
following u[n] and delta[n]
are the discrete unit step and unit impulse functions respectively. Find the
DTFT of each. Then, using
MATLAB, plot each of the functions on the domain [-7; 7] . Also plot the
magnitude of the DTFT of
the signal that you derive with domain [-pi, pi] . Later on this semester, we
will use functions in Matlab's
signal processing toolbox to study Fourier Transforms.
Hint: e^(-jwn) + e^(jwn) = 2 cos(wn).
(a) x[n] = u[n + 2] + u[n - 3]
8(a)
>> n = -7:1:7;
>> x = [ zeros(1, 15) ];
>> x(6:11) = 1;
>> stem(n, x);
>> w = -pi:pi/100:pi;
>> X = 2*cos(2*w) + 2*cos(w)+1;
>> plot (w, abs(X));
8(b) x[n] = (delta[n] + delta[n - 2] + delta[n + 2]) - (delta[n + 1] +
delta[n + 1])
>> n = -7:1:7;
>> x = zeros(1,15);
>> x(6:10) = [1 -1 1 -1 1];
>> stem(n, x);
w = -pi:pi/100:pi;
>> X = 2*cos(2*w) - 2*cos(w)+1;
>> plot (w, abs(X));
|