# Matlab Basics

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 $2+6-3$ and press Enter to execute the command. The Matlab shows the answer 5. In the second example, we type $4\times(3+2)-7$ and press Enter. The Matlab shows the answer 13. Similarly, the following examples show some more arithmetic problems, Matlab commands, and their answers.

Some basic Arithmetic in the Command Window

$(1) \quad 2\times(3+4)$

Matlab Command
>> 2*(3+4)

$(2) \quad (4.5)^2\times(1.61+1.72)^2-(13.4-12.3)^{-4}$

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

$(3) \quad \frac{9+4}{7-2}$

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

$(4) \quad 6^2+\frac{8}{4}-3$

Matlab Command
>> 6^2+8/4-3

$(5) \quad \frac{(3+2)^2}{\frac{6}{2}-1}$

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

$(6) \quad (5.5)^2\times(\frac{1}{5})^2+(15)^2+(\frac{1}{6}-\frac{1}{7})\times11$

Matlab Command
>> 5.5^2*1/5^2+15^2+(1/6-1/7)*11
$(7) \quad \frac{(0.25)^2\times(0.35)^{-3}}{(0.04)^4\times(0.5)^{-5}}$
$(8) \quad 50\times\Big[\Big\{(\frac{1}{4}+\frac{1}{3})\times2\Big\}-\Big\{(\frac{1}{5}-\frac{3}{4})\times\frac{1}{2}\Big\}\Big]$