02.03.2016 Views

MATLAB by rudra pratap

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

8.5 Using MuPAD Notebook<br />

245<br />

Define a function<br />

f: -Cx-1)*(x-a)•(•+PI)*(n2)*(•+3)<br />

l -(n:+x}\a-x}(x- t}(x+2Hx ·+ 3} +<br />

rs:expand(f)<br />

Muitiply out the e_xpre_ssion with •expand(:$<br />

MuPAD output<br />

l 6 ;r a -6 ;t .\' + 6 a x.+ .t x 1 + 4 t£. xJ + n /-fl :/'-4 a :l - a / - 6 .x 1 + i + 4 / • :i - :tax-4 ;;;: a x<br />

Solve glxl = 0 for x +----<br />

r soln: -solvo(9·•_)<br />

l ( -3. -2, !,a. -}<br />

Extract the flrs.t -element from the solution<br />

r soln[l]<br />

l ·3<br />

Evaluate g(X) at x=-3 (the ftrst solution)<br />

[(:) I xsoln[l]<br />

Take the limit of g(x)fx as x goe-s to pi<br />

limit(g/x, xPt)<br />

l (:t -1}(;n-2){a+l}(:2- :t-2a)<br />

[evalA.t(%, a-PI/2)<br />

[fplot :-plot: :FuncHon3d(f,<br />

Evaluate the answer at a = pl/2<br />

:': (:t -1} (:!-+ 2} (A + 3}<br />

X•-PL .PI, a -PL .PI);<br />

plot:Function3d( -(:t x} {a -x) (x -I} (x + 2) (x + 1}. x ... -a ."t. a "" -;t .. a)<br />

Text (comment) area<br />

1-n ax?<br />

ffdx. !I. !1n l.<br />

{.,,...,t f=>t<br />

fix-a<br />

it;:;: ••• a=o a:=i><br />

.<br />

a+b n! r-> f(x<br />

.sin a •• {x1 ire;_<br />

e .. oo u. .. n -<br />

.<br />

ill!!) @:!<br />

• Cerreral Mat h<br />

,.. PlotCommands<br />

plot(fplot)<br />

Figure 8.1: A typical session in a MuPAD Notebook MuPAD notebooks are invoked<br />

<strong>by</strong> typing mupad on the <strong>MATLAB</strong> command line. Once the Notebook opens, you<br />

are in the native MuPAD environment. All commands typed here must confirm to<br />

MuPAD syntax. Compare these commands with those shown in Fig. 8.2 used in<br />

the Symbolic Math Toolbox for the same set of calculations.

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

Saved successfully!

Ooh no, something went wrong!