02 - 2: Matlab Fundamentals 2: Chapter Objectives...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
2: Matlab Fundamentals 2: Matlab Fundamentals
Background image of page 1

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

View Full DocumentRight Arrow Icon
Sep 13, 2006 10:02 2 Chapter Objectives Introduction and overview of Matlab command mode and its use in interactive computations. Assignment of numbers (scalars) to variables. Assignment of vectors and matrices to variables; colon operator, linspace and logspace functions. Understand priority rules (for + , * , ^ , etc.) in arithmetic expressions. General understanding of some built-in functions. Use of the Help facilities. Learn how to use vectors to create simple plots of arithmetic expressions.
Background image of page 2
Sep 13, 2006 10:02 3 2.1 The Matlab Environment Matlab has 3 primary windows: Command window – enter commands and data, see results. Graphics window – used to display plots and graphs. Edit window – edit m-files (Matlab programs). See next chapter. Command window prompt: >> Enter arithmetic expressions: >> 55 – 16 Result is displayed: ans = 39 Can use the variable 'ans': >> ans + 11 ans = 50
Background image of page 3

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

View Full DocumentRight Arrow Icon
Sep 13, 2006 10:02 4 2.2 Assignment Scalar values can be assigned to variables: >> a = 4 a = 4 Variable names are case-sensitive : >> A = 5 A = 5 (output reformatted for brevity) >> a a = 4 >> A A = 5 Statements (“ commands ”) ending in ';' have output suppressed: >> A = 6; Several statements can be on one line: >> a = 4, A = 6; x = A-5; a = 4
Background image of page 4
Sep 13, 2006 10:02 5 Matlab Workspace Workspace contains variables and their values, functions, etc. Private to each user. Accumulates values and data as you work. Initially empty when Matlab starts except for built-in variables: i , j sqrt of -1 ̶ pi 3.14159. .. ̶ e 2.7183. .. ̶ eps realmin realmax Workspace normally disappears when Matlab exists Can be saved and restored later, on a different machine not usually done, as other techniques (scripts, m-files) are usually better. Very bad idea to change these built-in variables (except for i , j ).
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 2.2 Assignment (contd.) Matlab can deal with complex numbers: >> x = 2 + 4*i x = 2 + 4i >> x*x ans = -12 + 16i i and j are indistinguishable in defining complex numbers: >> x = 2 + 4*j x = 2 + 4i Until one of them is changed!! >> i = 6
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/13/2011 for the course CIVE 2*** taught by Professor - during the Spring '11 term at Carleton CA.

Page1 / 26

02 - 2: Matlab Fundamentals 2: Chapter Objectives...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online