Lecture05_Presentation

Lecture05_Presentation - 14:440: 127 Introduction to...

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

View Full Document Right Arrow Icon
14:440: 127 Introduction to Computers for Engineers LEC04/LEC05 Lecturer: Brenda Cortez 1 Rutgers School of Engineering 14:440:127 General Announcements PROJ01 Grades are posted - some missing due to Sakai issues. PROJ01 Grade questions addresses until next Thursday, March 3rd. ! see me in person during ofFce hours - no e-mails please EXAM01 Grades will be posted some time early next week. Tutoring today from 6:40pm - 8ish in DSV PS02 will be assigned soon - check Announcements/E-mail. REC QUIZ01 - starts tomorrow 2 Rutgers School of Engineering 14:440:127 Goals for Today Understand why we use MatLab and not C++ Review MatLab Windows Go over the fundamental topics from LEC04 Notes Get even more familiarized with the C++/MatLab syntax differences 3 Rutgers School of Engineering 14:440:127 Immediate C++ and MatLab Differences Compiled (C++) vs Interpreted (MatLab) No Increment/Decrement Operators in MatLab Control ±low Statements in MatLab must be ended with an end MatLab more forgiving about missing parenthesis/semicolons All variables in MatLab are arrays containing different data type 4
Background image of page 1

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

View Full DocumentRight Arrow Icon
Rutgers School of Engineering 14:440:127 Accessing MatLab Labs Labs Labs 5 Rutgers School of Engineering 14:440:127 Basics of MatLab Windows clear clc whos M-fle 6 Rutgers School of Engineering 14:440:127 Variables/File Names Cannot: ! start with numbers ! contain special characters/symbols or spaces ! be named aFter MatLab keywords (reserved words) ! Valid Names: mass, x, a32, k_1 ! Invalid Names: 1mass, 32x, k 1, a#1 7 Rutgers School of Engineering 14:440:127 Common Constants Imaginary Numbers: i and j ! , pi " , infnity, inf not a number, NaN 8
Background image of page 2
Rutgers School of Engineering 14:440:127 Comments Single Line Comment, % Block Comment, enclose with %{ and %} 9 Rutgers School of Engineering 14:440:127 Semicolon - ; Use it to suppress output to the screen ! x = 5 ; % will not send the value 5 to the screen For this class, you will need to always do this for all intermediate operations >> x = 2*pi; >> y = sin(x); >> disp(y) 10 Rutgers School of Engineering 14:440:127 Data Types All variables are arrays in MatLab that contain different data type values ! x = 5; % is of size 1x1, an array of one row by one column The default numeric data type is the double ! In this class, you will rarely have to cast a variable into a different data type Single characters and strings are enclosed in single quotes ! letter = # c $ ; ! className = # Intro to Computers for Engineers $ ; 11 Rutgers School of Engineering 14:440:127 Relational/Logical Operators 1. Relational: > < >= <= == ~= a) 0 is false . EVERYTHING ELSE is true b) ~= in MatLab, != in C++ 2. Logical & --true if both are true (AND) | --true if either is true (OR) ~ --Opposite (NOT) 3. && --short circuit AND, in A && B, the B operand would be evaluated only when the result of the entire expression is not fully determined by the A
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

Lecture05_Presentation - 14:440: 127 Introduction to...

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

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