Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

7205-1-6E AID:1825 | 18/10/2013

Consider the given MATLAB code:

4*5
a=ans*pi
b=ans/pi
ans

Type the given MATLAB code in MATLAB command window:

>> 4*5

The output for the above command is,

ans =

20

Type the given MATLAB code in MATLAB command window:

>> a=ans*pi

The output for the above command is,

a =

62.8319

Type the given MATLAB code in MATLAB command window:

>> b=ans/pi

The output for the above command is,

b =

6.3662

Type the given MATLAB code in MATLAB command window:

>> ans

The output for the above command is,

ans =

20

a  62.8319
Thus, the values of a, b and ans are b  6.3662 .
ans  20
The final value saved in ans is ans  20 .

The value of ans is retained for further calculations as the expression without an equal
sign is used only once in the given MATLAB code. If the expression without equal sign
is used more than once then the value of ans is overwritten.

You might also like