Digital Signal Processing Using MATLAB and Wavelets

Chapter 2 - MATLAB

MATLAB is a programming environment which has gained popularity due to its ease of use. The purpose of this chapter is not to teach MATLAB programming, but it is intended to provide a quick reference to MATLAB. It is easy to understand if you already know a programming language; if you do not, the following examples should help. Whether you are an experienced programmer or a beginner, the best thing to do is try the examples on your computer. MATLAB provides an interactive environment that makes this easy: you type a command, and it executes it. If there is a problem, it will let you know, and you can try again. If a command works well, you can copy and paste it into a file, creating a complex program one step at a time.

In fact, we will consider any group of commands that are stored in a file to be a program. The only distinction between a program and a function is the "function' keyword used in the first (noncomment) line in a file. This line specifies the inputs and outputs, as well as the function name. It is a good idea to give the function the same name as the file that it is stored in. The filename should also have ".m' as the extension. An example function will follow shortly.

MATLAB provides an editor, which will color text differently based on its functionality. Under this editor, comments appear in green, strings appear in red, and keywords (such as if, end, while) appear in blue. This feature helps the programmer spot errors with a command, such as where an unterminated string begins. This editor is not required, however, because any text editor will work. Here is one frustrating mistake that programmers occasionally make: if a program or function is changed in the editor, but not saved to disk, then the old version of it will be used when it is executed. Make sure to save your work before trying to run it!

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DSP Boards
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.