14-440-127 Lecture 1 Notes

14-440-127 Lecture 1 Notes - 14:440:127 Introduction to...

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

View Full Document Right Arrow Icon
14:440:127– Introduction to Computers for Engineers Notes for Lecture 1 Rutgers University, Fall 2008 Instructor- Blase E. Ur 0.1 Intro to the Matlab Environment 0.1.1 What Is Matlab? Matlab (”MATrix LABoratory”) is a software package (and accompanying programming language) that simplifies many operations in numerical methods, matrix manipulation/linear algebra, and other tasks engineers will often want to accomplish. The Matlab language shares common ideas (i.e. for loops, if statements ) with other languages like Java, C++, and Python. Matlab was chosen for this class because of its use in industry, elaborate Matrix manipulation functionality, tools for efficient graphing/plotting, implementation of numerical algorithms, and specialized toolkits. 0.1.2 Matlab Windows Generally, the window on the right-hand side of the Matlab screen is the command window. The command window allows you to type in Matlab code one line at a time. This can be good if you want to test out commands or do quick calculations. However, this can be bad if you have a very complicated set of calculations or tests you wish to complete. The window on the bottom left is the command history, which lets you see all of the commands you’ve typed into the command window. To the top left, you have a list of files in the current working directory, which could be useful if you’re working on a really big project. 0.1.3 Basic Math Operations First, we’ll try typing in mathematical expressions: 5+5 ans=10 3^2 ans=9 5*5 ans=25 Let’s say we make a mistake and instead wanted to type in 5*55 rather than 5*5. Conveniently, you can use the Up Key in the command window to cycle through your previous commands. This lets you repeat commands, but also lets you make small edits (which is very convenient).
Background image of page 1

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

View Full Document Right Arrow Icon
0.1.4 Setting Variables Matlab lets you save values (or the result of expressions) in variables. Variable names must start with a letter, contain only letters/numbers/underscores, and are case sensitive (i.e. X is different than x). The variable name should always be on the left side of the equals sign, and the value you wish to store in that variable should be on the right. Thus, you can type all of the following: X = 5 X = 5 X = 32 + 5 X = 37 WhenIAddNumbersIGet = 43+34 WhenIAddNumbersIGet = 77 However, the following examples don’t work: 1stNumber = 1 (Variable name must start with a letter) 5 = x (the variable must be on the left side) Super! = 4 (The exclamation point is not allowed) 0.1.5 Semicolon, Disp
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 5

14-440-127 Lecture 1 Notes - 14:440:127 Introduction to...

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

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