EGR_102_Lab_03B_MATLAB_Basics

# EGR_102_Lab_03B_MATLAB_Basics - MATLAB Basics EGR 102 Lab...

This preview shows pages 1–4. Sign up to view the full content.

EGR 102 Lab 03B 1 MATLAB ® Basics EGR 102 Lab 03B 2 Arithmetic Operators Arithmetic Operators: unary plus + +x unary minus - -x addition + x + y subtraction - a - 22 multiplication * pi * r division / circ / diam exponential ^ radius ^ 2

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
EGR 102 Lab 03B 3 Relational Operators Relational Operators: less than < x < y less than, equal to <= a<=22 equal to == x==100 not equal to ~= x~=25 greater than > classavg>90 greater than, equal to >= q>=57 EGR 102 Lab 03B 4 Relational Operators Example: Compute the average of 2 numbers & ask if the average is greater than a particular value >>student1 = 75 >>student2 = 92 >>average = (student1 + student2) / 2 >>classaverage = (average > 75) Why didn’t the answer indicate Yes or No? (the average is 83.5)
EGR 102 Lab 03B 5 Logical Values MATLAB deals with logical values and logical variables There are an infinite number of numerical values, but only 2 possible logical values exist: True and False In MATLAB, logic values are assigned to numbers 0 viewed as

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/23/2011 for the course EGR 102 taught by Professor Hinds during the Spring '09 term at Michigan State University.

### Page1 / 7

EGR_102_Lab_03B_MATLAB_Basics - MATLAB Basics EGR 102 Lab...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online