{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

02-Matlab Fundamentals

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

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 20, 2006 13:17 ECOR2606 -- Hassan & Holtz 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 20, 2006 13:17 ECOR2606 -- Hassan & Holtz 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 20, 2006 13:17 ECOR2606 -- Hassan & Holtz 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 20, 2006 13:17 ECOR2606 -- Hassan & Holtz 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: sqrt of -1 ̶ 3.14159... ̶ 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
Sep 20, 2006 13:17 ECOR2606 -- Hassan & Holtz 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
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern