Page 822 - Mechatronics with Experiments
P. 822

808   MECHATRONICS





























                                               ®
                              FIGURE A.2: MATLAB environment and main user interface windows.

                                   saves/accesses the files from the Current Working Directory. If it cannot find a file in
                                   the Current Working Directory, then it searches the deirectories defined in the “Path.”
                                                                                            ®
                                5. Launch Pad Window: to start different components of MATLAB , such as
                                          ®
                                   Simulink , StateFlow, and so on.
                                6. Profiler: The profile function is used to debug and optimize M-files by tracking their
                                   execution time. For each function in the M-file, the Profiler records information about
                                   execution time, number of calls, parent functions, child functions, code line hit count,
                                   and code line execution time.
                                7. Help Window: a separate window that allows access to a complete online help on all
                                                ®
                                   of the MATLAB tools.
                                      ®
                              MATLAB is used in one of two modes:
                                1. Interactive mode: the user types the commands in the “Command Window” and gets
                                   results after executing that command.
                                                                                   ®
                                2. Programming mode: the user writes programs in MATLAB language (also called
                                           ®
                                   MATLAB script) and saves them in M-files. The name of the M-file is typed at the
                                   command window to run the programs.

                                                         ®
                              A.1.1 Data in MATLAB Environment
                                        ®
                              In MATLAB , a data variable is created by giving it a name and assigning a value to
                              that name by placing it on the left hand side of an assignment statement. For instance, the
                              following example shows how to create a variable named “x” and assign a value to it. By
                              default, it has data type of double.
                              >>   x = 1.25 ;
                              Unlike in high level languages, such as C and Fortran, we do not need to declare the data
                              type of a variable before it is used.
   817   818   819   820   821   822   823   824   825   826   827