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

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

2: Matlab Fundamentals 2: Matlab Fundamentals

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

View Full Document
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.
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

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

View Full Document
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
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 ).

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

View Full Document
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
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
Ask a homework question - tutors are online
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}