Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with MATLAB (part 3) 1. Algebra, 2. Trig 3. The keyword ans 4. Clean up and suppress output: finalizing the software’s presentation 1.

Similar presentations


Presentation on theme: "Getting Started with MATLAB (part 3) 1. Algebra, 2. Trig 3. The keyword ans 4. Clean up and suppress output: finalizing the software’s presentation 1."— Presentation transcript:

1 Getting Started with MATLAB (part 3) 1. Algebra, 2. Trig 3. The keyword ans 4. Clean up and suppress output: finalizing the software’s presentation 1

2 1. Algebra Precedence rules apply: 2+3 2-6 2*3 7/3.5 2 2+3*3 (2+3)*3 5^2 i^2

3 2. Trigonometry Why does sin(30) give a “wrong” answer? _________________________ 3

4 2. Trigonometry Common functions sin(), cos(), tan(), sind(), cosd(), tand(), asin(), acos(), atan(), asind(), acosd(), atand() exp(), sqrt(), log(), log10() abs(), round() 4

5 3. The keyword ans 5

6 6

7 Next question: What is ans ? ____________ 7

8 4. Polishing the final product clear typed inside the command window  Will delete all the variables in the Workspace this time. There is no going back. This cleans up every variable from memory. (No more little yellow boxes in the Workspace) clc typed inside the command window  Will completely erase the content of the command window. It does not affect the Workspace - the variables still exist and can be used. 8

9 “Suppressing” the output Hiding intermediate results, or even initial variables 9 No semi-colons…

10 “Suppressing” the output Second version, with semi-colons 10 Using a semicolon on these lines “suppresses the output”. In other words, it does not show the result of the command. But… did the commands do anything?

11 “Suppressing” the output Still second version (with semi-colons) 11 The variables ARE CREATED, and commands ARE executed!

12 “Suppressing” the output Since the result does not show up automatically in the command window, to **recall** (i.e. show again) the variable: type area in the command window 12

13 Wrapping Up Algebra reminders Order of Operations: Parentheses Exponent Multiplication and Division are the same precedence Addition and Subtraction are the same precedence Trigonometry MATLAB standard trig functions use radians by default e.g. sin() uses radians; sind() uses degrees Suppressing the output: Use a semi-colon at the end of calculations 13


Download ppt "Getting Started with MATLAB (part 3) 1. Algebra, 2. Trig 3. The keyword ans 4. Clean up and suppress output: finalizing the software’s presentation 1."

Similar presentations


Ads by Google