Matlab → Getting started

This chapter begins with basics of Matlab and how it is used for basic calculations. Here we will introduce command window in detail.

**Command Window**

The first window that appears when we open Matlab is “Command Window”. It is the main window and it is used for simple calculations, and running and showing programs written in other windows; for example scripts and functions. You cannot save your commands or program in the command window to use them in the future.

When you start Matlab, the following screen appears. The window in the middle with sign *fx* >> is called “Command Window”.

Figure: Command Window, Matlab

**Use Matlab as a Calculator**

Figure: Basic Commands in Command Window

Type a command and press enter to execute the command. In the first example, we type and press * Enter* to execute the command. The Matlab shows the answer 5. In the second example, we type and press

*. The Matlab shows the answer 13. Similarly, the following examples show some more arithmetic problems, Matlab commands, and their answers.*

**Enter****Some basic Arithmetic in the Command Window**

__Matlab Command__

>> 2*(3+4)

Answer: 14

__Matlab Command__

>> 4.5^2*(1.61+1.72)^2-(13.4-12.3)^-4

Answer: 223.8672

__Matlab Command__

>> (9+14)/(7-2)

Answer: 4.6000

__Matlab Command__

>> 6^2+8/4-3

Answer: 35

__Matlab Command__

>> ((3+2)^2)/(6/2-1)

Answer: 12.5000

__Matlab Command__

>> 5.5^2*1/5^2+15^2+(1/6-1/7)*11

Answer: 226.4719

__Matlab Command__

>> (0.25^2*0.35^-3)/(0.04^4+0.5^-5)

Answer: 0.0456

__Matlab Command__

>> 50*(((1/4+1/3)*2)-((1/5-3/4)*1/2))

Answer: 72.0833