0% found this document useful (0 votes)
23 views

Evaluating Expressions: Unary Operators

The document provides an introduction to MATLAB, recommending trying examples to learn. It describes how to interrupt a MATLAB process using Control-C and exit using quit or the X button. It also notes that while much can be done in the command environment, other screens can increase productivity. It then discusses evaluating expressions by entering them after >> and lists unary and binary operators used in MATLAB.

Uploaded by

Anandha selvan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Evaluating Expressions: Unary Operators

The document provides an introduction to MATLAB, recommending trying examples to learn. It describes how to interrupt a MATLAB process using Control-C and exit using quit or the X button. It also notes that while much can be done in the command environment, other screens can increase productivity. It then discusses evaluating expressions by entering them after >> and lists unary and binary operators used in MATLAB.

Uploaded by

Anandha selvan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

The easiest way to learn how to use MATLAB is by doing. So, start playing.

It is
recommended
that you try all the examples in this guide.
If you get into trouble, you can usually interrupt a MATLAB process by typing Control-C
(usually written C-c for short). C-c gets its name from the fact that you type it by holding
down
CTRL and then pressing c. You will normally return the MATLAB prompt.
To exit MATLAB, type quit or exit at the prompt. You can also exit by clicking on the X in
the
upper right corner. (MATLAB functions like Windows-based programs.)
A great deal of work can be accomplished in the MATLAB command environment.
However,
there are other screens that can be accessed that can help productivity.
Evaluating Expressions
Expressions are evaluated by entering them after the >> followed by a carriage return.
MATLAB
displays the values preceded by “ans =”.
MATLAB follows the algebraic order of operations. Unary operators have right associativity
and
binary operators have left associativity.
Unary Operators
 + (positive)
 - (negative)
Binary Operators
 + (addition)
 - (subtraction)
 * (multiplication) (Multiplication is not inferred.)
 / (left-hand division)
 \ (right-hand division)
 ^ (exponent)
 ( ) (only grouping symbols allowed.)
>> 2 + 5 – 3
ans =
4
>> ans – 3
ans =
1
>> a = 12, b = 5
a =
12

You might also like