02.03.2016 Views

MATLAB by rudra pratap

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

236 Computer Algebra and The Symbolic Math Toolbox<br />

Macsyma, later imitated <strong>by</strong> Mathematica and others. In the recent past, computer<br />

algebra packages have added the ability to give numeric solutions and make nice<br />

plots. Even though these programs run slower, are harder to learn, and are harder<br />

to use than <strong>MATLAB</strong> for these purposes, Mathworks has felt the competition and<br />

responded <strong>by</strong> providing this toolbox.<br />

To master the Symbolic Math Toolbox, you have to master MuPAD, which is at<br />

least as much work as learning <strong>MATLAB</strong>. You also have to learn how to run MuPAD<br />

from inside <strong>MATLAB</strong> and keep your head straight at the same time. Basically, you<br />

type a command that makes sense to either plain <strong>MATLAB</strong> or MuPAD, and if<br />

plain <strong>MATLAB</strong> can't make sense of what you are requesting, it checks to see if you<br />

have typed a legitimate MuPAD command (i.e., <strong>MATLAB</strong>'s version of the MuPAD<br />

command) .<br />

8.1.1 Should you buy it?<br />

Although some people swear <strong>by</strong> them, symbolic calculations seem to be less useful<br />

than numeric computation to many people for two reasons. First, many problems<br />

are too hard to do symbolically. An infinitely fast computer doing symbolic computation<br />

will never tell you a formula for the integral of sin(log(x?), but <strong>MATLAB</strong><br />

will tell you the area under the curve as accurately as you would like (see Section<br />

5.4, page 152) . Second, the symbolic formulas one obtains are often unwieldy.<br />

How does, say, a 50-term symbolic formula give one more insight than a numeric<br />

calculation?<br />

With the Symbolic Math Toolbox, <strong>MATLAB</strong> can do essentially all that Mathematica,<br />

Maple, or MuPAD can do. Because the Symbolic Math Toolbox comes<br />

with the student edition of <strong>MATLAB</strong>, you might as well use MuPAD there for free.<br />

If you don't have the Symbolic Math Toolbox and you don't know of any symbolic<br />

calculations that you need to do, wait. Most engineers can do fine without it.<br />

If you want to do a lot of back and forth between symbolic and numeric computation,<br />

then <strong>MATLAB</strong>'s Symbolic Math Toolbox is just the thing for you.<br />

8.1.2 Two useful tools in the Symbolic Math Toolbox<br />

Before getting more involved, you should note two cute and useful tools that come<br />

with the Symbolic Math Toolbox.<br />

1. A quick way to make plots: ezplot. Here is the simplest way to make<br />

simple plots. This function (along with its cousins) is also available in basic<br />

<strong>MATLAB</strong> (see Section 3.8 on 92 for examples) .<br />

• The command ezplot sin(t), or more elaborately, ezplot (' sin(t) ') ,<br />

makes a plot of the sin function on the default interval ( -27f, 21r).<br />

• The command ezplot ( 't-2/exp (t) ' , [- 1 5] ) plots the function t2 jet<br />

over the interval ( -1, 5).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!