A Guide to MATLAB for Beginners and Experienced Users, Second Edition

Chapter 4: Beyond the Basics

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. But, as we mentioned briefly in Chapter 2, you can suppress the output of a command by putting a semicolon after the command. Here is an example.

<b class="bold">>> syms x</b><b class="bold">>> y = x + 7</b>y=x+7<b class="bold">>> z = x + 7;</b><b class="bold">>> z</b>z=x+7

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 series of commands when you are interested only in the output of the final command (several examples appear later in the chapter). As we noted in Chapter 2, 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.

Important Note

The most common use of the semicolon is to suppress the printing of a long vector or big matrix.

Another object that you may want to suppress is MATLAB s label for...

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: Switching Power Supplies
Finish!
Privacy Policy

This is embarrasing...

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