Page 16 -
P. 16

all relevant functions pertaining to that area. Now you may type help for
                             any function listed. For example, try help fmin.






                             1.2  Basic Algebraic Operations and Functions

                             The MATLAB environment can be used, on the most elementary level, as a
                             tool to perform simple algebraic manipulations and function evaluations.


                             Example 1.1
                             Exploring the calculator functions of MATLAB. The purpose of this example
                             is to show how to manually enter data and how to use basic MATLAB alge-
                             braic operations. Note that the statements will be executed immediately after
                             they are typed and entered (no equal sign is required).
                              Type and enter the text that follows the >> prompt to find out the MATLAB
                             responses to the following:

                                2+2
                                5^2
                                2*sin(pi/4)

                             The last command gave the sine of π/4. Note that the argument of the function
                             was enclosed in parentheses directly following the name of the function. There-
                             fore, if you wanted to find sin (π/4), the proper MATLAB syntax would be
                                                      3
                                sin(pi/4)^3

                              To facilitate its widespread use, MATLAB has all the standard elementary
                             mathematical functions as built-in functions. Type help elfun, which is
                             indexed in the main help menu to get a listing of some of these functions.
                             Remember that this is just a small sampling of the available functions.

                                help elfun

                             The response to the last command will give you a large list of these elemen-
                             tary functions, some of which may be new to you, but all of which will be
                             used in your future engineering studies, and explored in later chapters of
                             this book.


                             Example 1.2
                             Assigning and calling values of parameters. In addition to inputting data
                             directly to the screen, you can assign a symbolic constant or constants to rep-


                             © 2001 by CRC Press LLC
   11   12   13   14   15   16   17   18   19   20   21