Generating Signals with MATLAB |
MATLAB, acronym for MATrix LABoratory has become a very popular
software environment for complex based study of signals and
systems. Here we give some sample programmes to generate the
elementary signals discussed above. For details one should
consider MATLAB manual or read help files.
In MATLAB, ones(M,N) is an M-by-N matrix of ones, and zeros(M,N) is an M-by-N matrix of zeros. We may use those two matrices to generate impulse and step sequence.
|
The following is a program to generate and display impulse sequence. |
|
|
|
Here >> indicates the MATLAB prompt to type in a command, stem(n,x) depicts the data contained in vector x as a discrete time signal at time values defined by n. One can add title and lable the axes by suitable commands. To generate step sequence we can use the following program |
|
|
|
We can use the following program to generate real exponential sequence |
|
Note that, in this program, the base alpha is a scalar but the exponent is a vector, hence use of the operator to denote element-by-element power. |