Digital Signal Processing Reference
In-Depth Information
In the code above, note that the function definition is on the first line, and an example call that
you can paste into the Command Line (after removing or simply not copying the percent sign at the
beginning of the line, which marks the line as a comment line) and run by pressing Return. Thus you
would enter on the Command Line the following, and then press Return:
nY = LVMakePeriodicSeq([1 2 3 4],2)
In the above call, note that the output argument has been included; if you do not want the value
(or array of values) for the output variable to be displayed in the Command window, place a semicolon
after the call:
nY = LVMakePeriodicSeq([1 2 3 4],2);
If you want to see, for example, just the first five values of the output, use the above code to suppress
the entire output, and then call for just the number of values that you want to see in the Command window:
nY = LVMakePeriodicSeq([1 2 3 4],2); nY1to5 = nY(1:5)
The result from making the above call is
nY1to5 = [12341]
An example of the second type of script mentioned above, a non-function script is
N=1980; n = 0:1:N;y=0;fork=1:2:99;
y=y+(1/k)*sin(2*pi*10*k*n/N); end; figure; plot(y)
To run this script, paste the entire script into the Command Line and then press Return. The
pasting is best done by pasting the entire script in one operation and then pressing Return, although it
is usually possible to enter it line-by-line and press Return after entering each line, if desired. This is
obviously a slower method, however.
A.4 LEARNING TO USE M-CODE
While the intent of this topic is to teach the principles of digital signal processing rather than the use
of m-code per se, the reader will find that the scripts provided in the text and with the software package
will provide many examples of m-code programming, starting with simple scripts and functions early in
the topic, to much more involved scripts later in the topic, including scripts for use with MATLAB that
make extensive use of MATLAB objects such as push buttons, edit boxes, drop-down menus, etc.
Thus the complexity of the m-code examples and exercises progresses throughout the topic apace
with the complexity of signal processing concepts presented. It is unlikely that the reader or student
will find it necessary to separately or explicitly study basic m-code programming for use with this topic,
although it will occasionally be necessary and useful to use the online MATLAB or LabVIEW help files
for explanation of the use of, or call syntax of, various built-in functions.
A.5 WHAT YOU NEED WITH MATLAB AND LABVIEW
If you are using a professional edition of MATLAB, you'll need the Signal Processing Toolbox in addition
to MATLAB itself. The student version of MATLAB includes the Signal Processing Toolbox.
Search WWH ::




Custom Search