Signal Processing Toolbox Previous page   Next Page

Waveform Generation: Time Vectors and Sinusoids

A variety of toolbox functions generate waveforms. Most require you to begin with a vector representing a time base. Consider generating data with a 1000 Hz sample frequency, for example. An appropriate time vector is

where the MATLAB colon operator creates a 1001-element row vector that represents time running from zero to one second in steps of one millisecond. The transpose operator (') changes the row vector into a column; the semicolon (;) tells MATLAB to compute but not display the result.

Given t you can create a sample signal y consisting of two sinusoids, one at 50 Hz and one at 120 Hz with twice the amplitude.

The new variable y, formed from vector t, is also 1001 elements long. You can add normally distributed white noise to the signal and graph the first fifty points using


Previous page  Representing Signals Common Sequences: Unit Impulse, Unit Step, and Unit Ramp Next page

© 1994-2005 The MathWorks, Inc.