lecture1b - Introduction to Computer Programming with...

• Test Prep
• 5

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

Introduction to Computer Programming with MATLAB CEE/MAE M20 Lecture 1b Matlab Basics CEE/MAE M20 What is MATLAB? MATLAB = MATrix LABoratory MathWorks (the developers of MATLAB): “MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming.” Provides toolboxes and packages for a wide range of problems including image processing, finance, biology, etc. Interpreted Language. (Not a Compiled Language) 2 CEE/MAE M20 MATLAB Interface 3 Command Window Current Folder Toolstrip Workspace Command History Path CEE/MAE M20 Windows Current Folder - directory contents of the current path Command Window - allows single line execution of commands Workspace - displays current variables stored in memory. Command History - shows most recent commands executed using the command line. Toolstrip - menus for opening/saving scripts, importing data, viewing documentation, etc. 4 CEE/MAE M20 Command Line We can use MATLAB as a simple calculator via the command line >> 5 + 3 ans = 8 This assigns the value '8' to the variable 'ans' , which is displayed in the workspace Adding a semicolon to the end of the expression suppresses the display of 'ans' , but 'ans' still stores the value '8' >> 5 + 3; 5 CEE/MAE M20 MATLAB has built-in functions, constants and variables >> pi ans = 3.1416 >> cos(pi) ans = -1 >> sin(pi) ans = 1.2246e-16 Why did that happen? 6

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

CEE/MAE M20 The function 'sin' can only be approximated (for example, by a Taylor series) pi is an irrational constant made of infinite digits Computers cannot store infinitely long numbers 7 CEE/MAE M20
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