Page 46 - Numerical Analysis Using MATLAB and Excel
P. 46
Summary
1.11 Summary
• We can get help with MATLAB topics by typing help followed by any topic available. For
example, the command help matlab\iofun will display input/output information, and help mat-
lab graphics will display help on graphics.
• The MATLAB Demos menu displays MATLAB’s capabilities. To access it, we type demo and
we see the different topics. Whenever we want to return to the command window, we click on
the Close button.
•We type quit or exit when we are done and want to leave MATLAB.
• We use the clear command if we want to clear all previous values, variables, and equations
without exiting.
•The clc command clears the screen but MATLAB still remembers all values, variables and
equations which we have already used.
• All text after the % (percent) symbol is interpreted by MATLAB as a comment line and thus it
is ignored during the execution of a program. A comment can be typed on the same line as the
function or command or as a separate line.
• For computations involving complex numbers we can use either , or to denote the imagi-i j
nary part of the complex number.
• In MATLAB, a polynomial is expressed as a row vector of the form a a n – 1 a a a ] 2 1 0 . The
[
n
elements of this vector are the coefficients of the polynomial in descending order. We must
a
i
include terms whose coefficients are zero.
• We find the roots of any polynomial with the roots(p) function where p is a row vector con-
taining the polynomial coefficients in descending order.
• We can compute the coefficients of a polynomial from a given set of roots with the poly(r)
function where r is a row vector containing the roots.
•The polyval(p,x) function evaluates a polynomial px() at some specified value of the inde-
x
pendent variable .
•The conv(a,b) function multiplies the polynomials a and b.
•The [q,r]=deconv(c,d) function divides polynomial c by polynomial d and displays the quo-
tient q and remainder r.
•The polyder(p) function produces the coefficients of the derivative of a polynomial p.
• We can write MATLAB statements in one line if we separate them by commas or semicolons.
Commas will display the results whereas semicolons will suppress the display.
Numerical Analysis Using MATLAB® and Excel®, Third Edition 1−33
Copyright © Orchard Publications