In this chapter, we describe some of the finer points of MATLAB and review in more detail some of the concepts introduced in Chapter 2. We explore enough of MATLAB's internal structure to improve your ability to work with complicated functions, expressions, and commands. At the end of this chapter, we introduce some of the MATLAB commands for doing calculus.
Suppressing Output
Some MATLAB commands produce output that is superfluous. For example, when you assign a value to a variable, MATLAB echoes the value. You can suppress the output of a command by putting a semicolon after the command. Here is an example:
The semicolon does not affect the way MATLAB processes the command internally, as you can see from its response to the command z.
You can also use semicolons to separate a string of commands when you are interested only in the output of the final command (several examples appear later in the chapter). Commas can also be used to separate commands without suppressing output. If you use a semicolon after a graphics command, it will not suppress the graphic.
⇒ The most common use of the semicolon is to suppress the printing of a long vector, as indicated in Chapter 2.
Another object that you may want to suppress is MATLAB's label for the output of a command. The command disp is designed to achieve that; typing disp(x) will print the value of the variable x without printing the label and the equal sign.