02.03.2016 Views

MATLAB by rudra pratap

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1.6 Basics of <strong>MATLAB</strong><br />

7<br />

2. Figure window: The output of all graphics commanrls typed in the command<br />

window are flushed to the graphics or figure window, a separate gray<br />

window with (default) white background color. The user can create as many<br />

figure windows as the system memory will allow.<br />

3. Editor window: This is where you write, edit , create, and save your own<br />

programs in files called M-jiles. You can use any text editor to carry out these<br />

tasks. On most systems, <strong>MATLAB</strong> provides its own built-in editor. However,<br />

you can use your own editor <strong>by</strong> typing the standard file-editing command that<br />

you normally use on your system. From within <strong>MATLAB</strong>, the command is<br />

typed at the <strong>MATLAB</strong> prompt following the exclamation character (!). The<br />

exclamation character prompts MATLAD to return the control temporarily<br />

to the local operating system, which executes the command following the<br />

character. After the editing is completed, the control is returned to <strong>MATLAB</strong>.<br />

For example, on UNIX systems, typing ! vi myprogram .m at the <strong>MATLAB</strong><br />

prompt (and hitting the return key at the end) invokes the vi editor on the<br />

file myprogra m.m. Typing !emacs myprogram .m invokes Lhe emacs editor.<br />

1.6.2 On-line help<br />

• On-line documentation: <strong>MATLAB</strong> provides on-line help for all its builtin<br />

functions and programming language constructs. The commands lookfor,<br />

help, helpwin, and helpdesk provide on-line help. See Section 3.6 on page 85<br />

for a description of the help facility.<br />

• Demo: <strong>MATLAB</strong> has a demonstration program that shows many of iLo; features.<br />

The program includes a tutorial introduction that is worth trying.<br />

Type demo at the <strong>MATLAB</strong> prompt to invoke the demonstration program,<br />

and follow the instructions on the screen.<br />

1.6.3 Input-output<br />

<strong>MATLAB</strong> supports interactive computation (see Chapter 3), taking the input from<br />

the screen, and flushing the output to the screen. In addition, it can read input<br />

files and write output files (see Section 4.3.7) . The following features hold for all<br />

forms of input-output:<br />

• Data type: The fundamental data type in <strong>MATLAB</strong> is an array. It encompasses<br />

several disLlnct data objects-integers, doubles (real numbers) , matrices,<br />

character strings, structures, and cells.3 In most cases, however, you<br />

never have to worry about the data type or the data object declarations. For<br />

example, there ia no need to declare variables as nml or complex. WhP.n a real<br />

numl.Jer is euLered as the value of a variable, <strong>MATLAB</strong> automatically sets the<br />

variable to be real (double).<br />

3 Structures and cells as data objects were introduced in <strong>MATLAB</strong> 5. See Section 4.4 on page 121<br />

fur their dcBcription. <strong>MATLAB</strong> also allow nPr to create their OWn data objects and MSOciatcd<br />

operations. We do not discuss this facility in this book.

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

Saved successfully!

Ooh no, something went wrong!