Recitation 1 Solution

# Recitation 1 Solution - x [ n ] at n = 1 to be zero. 3....

This preview shows pages 1–2. Sign up to view the full content.

ECEN 314: Signals and Systems Solutions to Recitation 1 1. Let x = [1 2 3 4 5 6] and y = [7 8 9 10 11 12] be two vectors. Write a one line command to ﬁnd the sum of the product of the ﬁrst three elements in x and that of the last three elements in y . Solution: sum(x(1:3).*y(4:6)) 2. Let x [ n ] be a discrete-time signal such that x [ n ] = 2 , n = 0 , 1 , n = 2 , - 1 , n = 3 , 3 , n = 4 , 0 , otherwise . Use MATLAB to plot x [ n ]. Make sure that your plot covers all the nonzero values of x [ n ]. Solution: n=0:5; x=[2 0 1 -1 3 0]; stem(n,x); Note that we need to explicitly specify the value of

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x [ n ] at n = 1 to be zero. 3. Plot the following signals (a) y 1 [ n ] = x [ n ] + 2. Solution: n1=n; y1=x+2; stem(n1,y1); % Note that x and n are defined in problem 2 (b) y 2 [ n ] = 3 x [ n ]. Solution: n2=n; y2=3*x; stem(n2,y2); (c) y 3 [ n ] =-x [ n ]. Solution: n3=n; y3=-x; stem(n3,y3); (d) y 4 [ n ] = x [ n + 1]. Solution: n4=-1:4; y4=x; stem(n4,y4); (e) y 5 [ n ] = x [-n ]. 1 Solution: n5=-n; y5=x; stem(n5,y5); (f) y 6 [ n ] = x [2 n ]. Solution: n6=0:2; y6=x(1:2:end); stem(n6,y6); 2...
View Full Document

## This note was uploaded on 01/01/2012 for the course ECEN 314 taught by Professor Halverson during the Spring '08 term at Texas A&M.

### Page1 / 2

Recitation 1 Solution - x [ n ] at n = 1 to be zero. 3....

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

View Full Document
Ask a homework question - tutors are online