Basic Signals

1. Generate and plot (using MATLAB'S stem command) the sequence

x[n] = (0.95)n cos(/20 n)

for 0 ≤ n ≤ 63. Note that MATLAB'S indexing for the first element starts with 1 and not 0, so you will have to adjust for this in your plot.

2. The following is a simple example of a MATLAB function framp which generates an N-point ramp x[n] = n for 1 ≤ n ≤ N. The input argument is N and the function generates the desired values.

function x=framp(N)

% function x=framp(N)

% Generates an N-point ramp sequence

n=l:N;

x=n' ;

Write a MATLAB function, fcosine, which will generate the values from a finite-length sinusoid A cos(0n + ) for n1≤ n ≤ nf. The function will need a total of five input arguments: A, 0, , n1, and nf. The function should return a column vector which contains only the desired values of the sinusoid. Test your function by plotting the results with A = 4, 0 = /10, = /4, n1 = -20, and nf = 20.

Impulse Response and Step Response

Consider an LTI system where the input x[n] and output y[n] satisfy the following difference equation (assume initial rest conditions):

3. Using filter, generate and plot the response y[n] for -10 ≤ n ≤ 100 when the input is x[n] = [n], the unit impulse sequence.

4. Generate and plot the response y[n] for -10 ≤ n ≤ 100 when the input is x[n] = u[n], the unit step sequence.

System Functions, Frequency Response, and Pole/Zero Plots

The system function of the LTI system in Exercises 3 and 4 is given by:

5. Using freqz with N = 512, make plots of the magnitude and phase responses |H()| and H() for 0 ≤ ≤ . Specify what type of filter this system represent s(i.e. lowpass, highpass, bandpass, etc.).

6. Use zplane to make a pole/zero plot of all finite poles and zeros of H(z). (Hint: To determine all finite poles and zeros, Express H(z) in positive powers of z by multiplying the numerator and denominator by an appropriate power of z.)

1. Generate and plot (using MATLAB'S stem command) the sequence

x[n] = (0.95)n cos(/20 n)

for 0 ≤ n ≤ 63. Note that MATLAB'S indexing for the first element starts with 1 and not 0, so you will have to adjust for this in your plot.

2. The following is a simple example of a MATLAB function framp which generates an N-point ramp x[n] = n for 1 ≤ n ≤ N. The input argument is N and the function generates the desired values.

function x=framp(N)

% function x=framp(N)

% Generates an N-point ramp sequence

n=l:N;

x=n' ;

Write a MATLAB function, fcosine, which will generate the values from a finite-length sinusoid A cos(0n + ) for n1≤ n ≤ nf. The function will need a total of five input arguments: A, 0, , n1, and nf. The function should return a column vector which contains only the desired values of the sinusoid. Test your function by plotting the results with A = 4, 0 = /10, = /4, n1 = -20, and nf = 20.

Impulse Response and Step Response

Consider an LTI system where the input x[n] and output y[n] satisfy the following difference equation (assume initial rest conditions):

3. Using filter, generate and plot the response y[n] for -10 ≤ n ≤ 100 when the input is x[n] = [n], the unit impulse sequence.

4. Generate and plot the response y[n] for -10 ≤ n ≤ 100 when the input is x[n] = u[n], the unit step sequence.

System Functions, Frequency Response, and Pole/Zero Plots

The system function of the LTI system in Exercises 3 and 4 is given by:

5. Using freqz with N = 512, make plots of the magnitude and phase responses |H()| and H() for 0 ≤ ≤ . Specify what type of filter this system represent s(i.e. lowpass, highpass, bandpass, etc.).

6. Use zplane to make a pole/zero plot of all finite poles and zeros of H(z). (Hint: To determine all finite poles and zeros, Express H(z) in positive powers of z by multiplying the numerator and denominator by an appropriate power of z.)