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.

50 Tutorial Lessons<br />

EXERCISES<br />

1. Some basic symbolic manipulations: Define the following function symbolically<br />

f(x) = (x2 - 4x)(x2 - 4x + 1) - 20.<br />

(a) Expand f(x) using expand.<br />

(b) Show that (x2 - 4x + 4) is a factor of f <strong>by</strong> dividing f with this factor.<br />

(c) Factorize f using the symbolic function factorize and verify the factor<br />

you used in (b).<br />

(d) Find the roots of one of the two factors. (Hint: Take one of the factors<br />

as an expression and use solve to find two roots x1 and x 2 ).<br />

(e) Substitute one of the roots for x, say x =<br />

x1, in f and simplify the<br />

expression to show that j(x1) = 0.<br />

2. Computation with symbolic vectors: Define r = [x yjT where x and y<br />

are declared as real variables. Compute<br />

(a) rrT (the outer product of r) .<br />

(b) J0 1 rrT dx.<br />

(c) f0 1 f0 1 rrT dxdy.<br />

(d) Determinant of J; J0 1 rrT dxdy.<br />

3. Solving simultaneous linear equations: Solve the following set of simultaneous<br />

linear algebraic equations.<br />

X+ 3y - Z 2<br />

x-y+z 3<br />

3x - 5y 4.<br />

4. Solving simultaneous linear equations: Solve the following nonlinear<br />

algebraic equations simultaneously.<br />

3x 3 + x 2 - 1 0<br />

x4 - 10x 2 + 2 0.<br />

5. Integrals: Find the following integrals:<br />

(i) 100 e-xdx, (ii) 100 e-x2 dx , and (iii) lxo e-x2 sin(x)dx.<br />

6. Solving differential equations: Use function dsolve to solve the following<br />

differential equations along with the given initial conditions.<br />

(a) + x2 = 0, x(O) = xo.<br />

(b) + w2y = 0, y(O) = Yo and (0) =<br />

Vo .<br />

[First, use on-line help on dsol ve to see how to enter the differential equation<br />

and the initial conditions as input to the function. Please note that this<br />

function requires the differential operator ft to be denoted <strong>by</strong> D. Therefore,<br />

the first differential equation will be written as Dx + x-2 = 0].

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

Saved successfully!

Ooh no, something went wrong!