You are on page 1of 1

MATLAB Exercises (Assignment I)

1. Write a MATLAB Program to generate the following sequences and plot them using the stem function: a. Unit Impulse Sequence (n), b) Unit Step Sequence u(n), & c) Ramp Sequence r(n) = n u(n). The input parameters specified by the user are the desired length L of the sequence and the sampling frequency FT in Hz. Using this program the first generate the first 100 samples of each of the above sequences with sampling rate of 20 kHz. 2. Let x(n)=,2,4,3,1,5,4,7-. Generate and plot the samples (use the stem function) of the following sequences. a. x1(n)=2x(n3)+3x(n+4)x(n) c. x3(n)=x(n+3)x(n2) +x(1n)x(n+1) d. x4(n)=2e0.5n x(n)+cos (0.1n)x(n+2), 10n10 3. Generate the following sequences using the basic MATLAB signal functions and the basic MATLAB signal operations discussed in this chapter. Plot signal samples using the stem function. a. x1(n) = 3(n+2)+2(n)(n3) + 5(n7),5n15

b. x2(n)=4x(4 +n)+5x(n+5)+2x(n)

b. X2(n) = 10u(n)5u(n5)10u(n10)+5u(n15) c. X3(n) = e *u(n+ 20)u(n10)+ d. X4(n) = 5*cos(0.49n)+cos(0.51n)+, 200n200. Comment on the waveform shape. e. X5(n) = e0.01n [sin(0.1n)], 0n100. Comment on the waveform shape. 4. Let a discrete-time signal x(n) is an input to an LTI system with impulse response h(n). Determine the output y(n) using conv function. a. x(n)=*3,11,7,0,1,4,2+ ; h(n)=*2,3,0,5,2,1+, b. x(n)=u(n)u(n10) ; h(n)=(0.9) u(n), 10n10

c. x(n)=n/4*u(n)u(n6)+, h(n)=2*u(n+2)u(n3) 5. Compute the a. Auto correlation, and b. Cross Correlation of the following sequences: i. x(n)=,2,4,5,3,1,2,6-, h(n)=,1,1,1,1,1ii. x(n)=(1/4)n*u(n+1)u(n4)+, iii. x(n)=(0.9)n, 0n20; h(n)=u(n)u(n5)

y(n)=(0.8)n, 20n0

6. A linear and time-invariant system is described by the difference equation y(n)0.5y(n1)+0.25y(n2) = x(n)+2x(n1) +x(n3) a. Using the filter function, compute and plot the impulse response of the system over 0n100. b. Determine the stability of the system from this impulse response. c. If the input to this system is x(n)=*5 + 3 cos(0.2n)+4sin(0.6n)+u(n), determine the response y(n)over 0n200 using the filter function