20072ee132A_1_ca1sol

20072ee132A_1_ca1sol - EE132A, Spring 2007 Prof. John...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
EE132A, Spring 2007 Communication Systems Prof. John Villasenor Computer Assignment #1 Solution Note: Through out this computer assignment solution, the sign (*) is used as the convolution sign and (.) is used for the multiplication . Question #1 a- Lets define y1 (n) = x (n)*h (n). The plots of x (n), h (n) and their convolution y1 (n) are shown below.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The Matlab code for part (a) is as following: %EE132A Computer Assignment 1 %Problem 1 part A %generate x1 sequence as given x1 = [ 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 ]; %generate h1 sequence as a rect of length 5 h1 = ones(1,5); %convolve x1 and h1 y1 = conv(x1,h1); %********* %the code below is a bit complicated, it is just meant to produce a %nice graph of all three functions at the same time with the correct %time scale. %determine output length (will be used for plotting) y1_length = length(y1); x1_length = length(x1); h1_length = length(h1); %generate vectors that are used for plotting the time axis and sequences n_plot = [0:y1_length-1]; x1_plot = x1; x1_plot(x1_length+1:y1_length) = 0; h1_plot = h1; h1_plot(h1_length+1:y1_length) = 0; %please note: STEM(X,Y) plots data sequence Y at the values specified in X. %the SUBPLOT(m,n,p) allows plotting multiple graphs at the same time. subplot(3,1,1); stem(n_plot, x1_plot,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

20072ee132A_1_ca1sol - EE132A, Spring 2007 Prof. John...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online