def ex6_2(n):
x = np.zeros(len(n))<EOL>for k, nn in enumerate(n):<EOL><INDENT>if nn >= -<NUM_LIT:2> and nn <= <NUM_LIT:5>:<EOL><INDENT>x[k] = <NUM_LIT:8> - nn<EOL><DEDENT><DEDENT>return x<EOL>
Generate a triangle pulse as described in Example 6-2
of Chapter 6.

You need to supply an index array n that covers at least [-2, 5]. 
The function returns the hard-coded signal of the example.

Parameters
----------
n : time index ndarray covering at least -2 to +5.

Returns
-------
x : ndarray of signal samples in x

Examples
--------
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from sk_dsp_comm import sigsys as ss
>>> n = np.arange(-5,8)
>>> x = ss.ex6_2(n)
>>> plt.stem(n,x) # creates a stem plot of x vs n