General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

2.3 Modeling Real World Data with Matrices
Section 13-4: Matrix Multiplication
Maths for Computer Graphics
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
General Computer Science for Engineers CISC 106 Lecture 02 James Atlas Computer and Information Sciences 6/10/2009.
General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
General Computer Science for Engineers CISC 106 Lecture 04 Roger Craig Computer and Information Sciences 9/11/2009.
Introduction to MATLAB
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
General Computer Science for Engineers CISC 106 Final Exam Review Dr. John Cavazos Computer and Information Sciences 05/18/2009.
EGR 106 – Week 2 – Arrays & Scripts Brief review of last week Arrays: – Concept – Construction – Addressing Scripts and the editor Audio arrays Textbook.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB.
Lecture 13 Decision structures
General Computer Science for Engineers CISC 106 Lecture 25 Dr. John Cavazos Computer and Information Sciences 04/20/2009.
General Computer Science for Engineers CISC 106 Lecture 13 Roger Craig Computer and Information Sciences 3/13/2009.
General Computer Science for Engineers CISC 106 Lecture 05 Dr. John Cavazos Computer and Information Sciences 2/20/2009.
General Computer Science for Engineers CISC 106 Lecture 23 Dr. John Cavazos Computer and Information Sciences 4/15/2009.
Al-Amer An Introduction to MATLAB Dr. Samir Al-Amer Term 062.
General Computer Science for Engineers CISC 106 Lecture 18 Dr. John Cavazos Computer and Information Sciences 3/27/2009.
Matlab Basics IEF 217a: Lecture 2 Fall 2002 Sigmon and Davis, chapters 1-7.
MATLAB FOR PATTERN RECOGNITION By: Özge Öztimur. How Much Do We Know? Anybody who has never used MATLAB?
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 21P. 1Winter Quarter MATLAB: Structures.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 06/29/2009.
Matlab Programming, part 1 M-files It is generally more convenient to program in Matlab using m-files, ascii text files containing a set of Matlab commands.
Introduction to MATLAB Session 3 Simopekka Vänskä, THL Department of Mathematics and Statistics University of Helsinki 2011.
CMPS 1371 Introduction to Computing for Engineers CONDITIONAL STATEMENTS.
Matlab for Engineers Manipulating Matlab Matrices Chapter 4.
MATLAB Practice 1 Introducing MATLAB Lecture Notes on Video Search & Mining, Spring 2012 Presented by Jun Hee Yoo Biointelligence Laboratory School of.
MAE 1202: AEROSPACE PRACTICUM An Introduction to MATLAB: Part 2 Mechanical and Aerospace Engineering Department Florida Institute of Technology Developed.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 18P. 1Winter Quarter Introduction to MATLAB Lecture 18.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 2/13/2009.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
Introduction to Matlab Module #4 Page 1 Introduction to Matlab Module #4 – Programming Topics 1.Programming Basics (fprintf, standard input) 2.Relational.
Recap Saving Plots Summary of Chapter 5 Introduction of Chapter 6.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Matrix Algebra Section 7.2. Review of order of matrices 2 rows, 3 columns Order is determined by: (# of rows) x (# of columns)
8.2 Operations With Matrices
Matlab Programming a logical approach. Outline Announcements: –Homework I: due Wed. by 5, by –Last day to add/drop or change credit/audit Iteration.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
General Computer Science for Engineers CISC 106 Lecture 13 - Midterm Review James Atlas Computer and Information Sciences 10/02/2009.
1 Lecture 3 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
General Computer Science for Engineers CISC 106 Lecture 15 Dr. John Cavazos Computer and Information Sciences 03/16/2009.
General Computer Science for Engineers CISC 106 Lecture 14 James Atlas Computer and Information Sciences 08/10/2009.
13.4 Product of Two Matrices
12-1 Organizing Data Using Matrices
ECE 1304 Introduction to Electrical and Computer Engineering
Matrices Rules & Operations.
Scripts & Functions Scripts and functions are contained in .m-files
Introduction to MATLAB
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
Use of Mathematics using Technology (Maltlab)
MATRICES MATRIX OPERATIONS.
Logical Operations In Matlab.
INTRODUCTION TO MATLAB
Multiplying Matrices.
Using Script Files and Managing Data
3.6 Multiply Matrices.
Multiplying Matrices.
Multiplying Matrices.
Introduction to Matrices
ME 123 Computer Applications I Lecture 4: Vectors and Matrices 3/14/03
Multiplying Matrices.
Presentation transcript:

General Computer Science for Engineers CISC 106 Lecture 08 Dr. John Cavazos Computer and Information Sciences 2/27/2009

Lecture Overview Miscellaneous stuff Relational Operators ◦ what they are ◦ what we can do with them more complex IF statements ◦ using with relational operators how to use Arrays

How Matlab looks for M-files ◦ Go to Upper left hand corner “File” Menu Option ◦ Click on “Set Path” menu option ◦ Add directory where you have m-files

Maneuvering in command window ◦ Everything you type is in your command history ◦ Up arrow moves up the command history ◦ Down arrow moves down the command history

Scripts versus Functions ◦ Scripts are m-files with Matlab commands ◦ Functions are a special type of m-file ◦ Both end with.m ◦ Functions are called by name and inputs ◦ inputs also known as parameters or arguments More on scripts versus functions ◦ mming/scripts.html#scriptsVSfuncs

Functions ◦ myfunction(x, y); Comma separates arguments Will look in “path” of directories for an m- file called myfunction.m first argument second argument

Major Relational Operators ◦ A < B A is less than B ◦ A > B A is greater than B ◦ A <= B A is less than or equal to B ◦ A >= B A is greater than or equal to B ◦ A == B A is equal to B ◦ A ~= B A not equal B

Relational Operators Relational operators can only be used to compare two numbers or arrays NOT to be used for strings Use strcmp function to compare strings WARNING!! the operator = assigns a value, do not confuse this with the == operator which tests if two things are equal

Relational Operators If condition is true Statement in if statement executes If condition is false Statement does not execute 5 < 6 returns true 7 < 6 returns false 7 == 7 returns true 7 ~= 8 returns true 4 >= 5 returns false

IF Statements Order matters for if statements if multiple conditions are true the first one reached is the one that is chosen. if (7 > 5 ) 200 elseif (4 > 3) 300 else 400 end Both conditions are true, but the second condition is never reached!

IF Statement example > x = 6 if (x > 5 ) 200 elseif (x > 3) 300 else 400 end > 200

IF Statements Nested if statements can be used when two things have to be true for a command to execute

IF Statements Using nested if statements if (x < 5) if ( x > 2) y = 500 else y = 300 else y= 200 end Using multiple conditions in one if statement if ( x 2) y = 500 else y = 200 end

Arrays (aka Matrices) When dealing with matrices we refer to their size as row by column ◦ 2 x 3 matrix has two rows and three columns

Arrays Multiply a scalar by a matrix means multiplying each element of that matrix by that scalar 4 * 1 2 =