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 />

9<br />

• Dimensioning: Dimensioning is automatic in <strong>MATLAB</strong>. No dimension statements<br />

are required for vectors or arrays. You can find the dimensions of an<br />

existing matrix or a vector with the size and length (for vectors only) commands.<br />

• Case sensitivity: <strong>MATLAB</strong> is case-sensitive; that is, it differentiates between<br />

the lowercase and uppercase letters. Thus a and A are different variables.<br />

Most <strong>MATLAB</strong> commands and built-in function calls are typed in<br />

lowercase letters. You can turn case sensitivity on and off with the casesen<br />

command. However, we do not recommend it.<br />

• Output display: The output of every command is displayed on the screen<br />

unless <strong>MATLAB</strong> is directed otherwise. A semicolon at the end of a command<br />

suppresses the screen output, except for graphics and on-line help commands.<br />

The following facilities are provided for controlling the screen output:<br />

- Paged output: To direct <strong>MATLAB</strong> to show one screen of output at<br />

a time, type more on at the <strong>MATLAB</strong> prompt. Without it, <strong>MATLAB</strong><br />

fiushes the entire output at once, without reganl to the speed at which<br />

you read.<br />

Output format:<br />

Though computations inside <strong>MATLAB</strong> are performed using double precision,<br />

the appearance of floating point numbers on the screen is controlled<br />

<strong>by</strong> the output format in use. There are several different screen output<br />

formats. The following table shows the printed value of l01r in seven<br />

different formats.<br />

format short 3 1 . 4 159<br />

format short e 3.1416e+001<br />

format long 31 .41 592653589793<br />

format long e 3.141592653589793e+001<br />

format short g 31 . 4 16<br />

format long g 31 .4159265358979<br />

403f6a7a2955385e<br />

format hex<br />

format rat 3550/113<br />

format bank 31 .42<br />

The additional formaLs, format compact and format loose, control the<br />

spacing above and below the displayed lines, and format + displays a + ,<br />

-, and blank for positive, negative, and zero numbers, respectively. The<br />

default is format short. The di::lplay funnat iB Bet <strong>by</strong> typing formo.t<br />

type on the command line (see Fig. 2.1 on page 18 for an example).<br />

• Command history: <strong>MATLAB</strong> saves previously typed commands in a buffer.<br />

These commands can be recalled with the up-arrow key (f). This helps in<br />

editing previous commands. You can also recall a previous command l!y<br />

typing the first few characters and then pressing the T key. Alternatively, you<br />

can double-click on a command in the Command History pane (where all your<br />

[or pnline help<br />

type: ,<br />

rhlp format .

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

Saved successfully!

Ooh no, something went wrong!