This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: INTERACTIVE MATLAB TUTORIAL Your computer should have MSWords 97 and MATLAB 5.2 or higher for complete use of all the features in this document. This document is an example of a MATLAB NOTEBOOK template (MBOOK.DOT). It is a seamless interface between MSWords and MATLAB. When the file is opened as a MSWords document, MATLAB is automatically started and commands typed on the document can be executed by MATLAB. The results are directed back to the document. The TRAINER provides a first time MATLAB user with basic instructions on syntax and commands through examples, many of them interactive As the user progresses along this document, he/she will be exposed to more advanced commands and options. It is strongly recommended that the user execute all the suggested exercises in the text . If the user wants to keep a pristine copy of the TRAINER document he/she should make a backup copy before starting the interactive operation. Alternatively, it is possible to use the TRAINER and not save the document at the end of the session. Overview of MATLAB In its basic form MATLAB is a command line interpreter. Each line entered from the keyboard is compiled and executed as soon as the user signals endofline with the carriage return. If the program detects a syntax error or cannot recognize the instruction(s), it will provide warning and error messages. The user can end a command in any of the following forms carriage return (CR) comma carriage return (,CR) semi colon carriage return (;CR) The first two terminators indicate to MATLAB that the user wants the results displayed on the screen. Using the semi colon terminator inhibits the echo of results. This is very convenient if the results are large arrays of numbers. Semicolon is the recommended terminator for normal MATLAB computations. The three alternatives are shown below. The percentage sign is the comments indicator. Everything from there until the endofline will be ignored by MATLAB. x=3+5 %terminate with carriage return (CR) x = 8 MATLAB displays answer on screen x=3+5, %terminates with comma and CR x = 8 MATLAB displays answer on screen x=3+5; %terminates with semicolon and CR no display of answer This document normally uses the first two alternatives in order to show the user the results of computations. From the point of view of capabilities, MATLAB is a very powerful calculator where the basic data structure is the array. All operations are heavily overloaded and will produce the expected results. For example, the symbol + will be interpreted as integer sum if the operands are integer, as ordinary sum if the operands are reals, complex addition if the operands are complex numbers, vector addition if the operands are vectors (one dimensional arrays) and matrix addition if the operands are matrices....
View
Full Document
 Fall '08
 ARAVENA
 matlab, Carriage return, MATLAB command

Click to edit the document details