A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.

Slides:



Advertisements
Similar presentations
Department of Computer Science. Definition “An operator is a symbol (+,-,*,/) that directs the computer to perform certain mathematical or logical manipulations.
Advertisements

Slide deck by Dr. Greg Reese Miami University MATLAB An Introduction With Applications, 5 th Edition Dr. Amos Gilat The Ohio State University Chapter 3.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
Slide 1 Summary Two basic concepts: variables and assignments Some C++ practical issues: division rule, operator precedence  Sequential structure of a.
All the Operators. Precedence An operator with higher precedence is done earlier (prededes) one with lower precedence –A higher precedence is indicated.
All the Operators. Precedence An operator with higher precedence is done earlier (prededes) one with lower precedence –A higher precedence is indicated.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
Fall 2006AE6382 Design Computing1 Relational and Logical Operators Use relational operators to test two values Work with values of true and false Compare.
Unit 2 Common Fractions. 2 FRACTION A fraction is a value that shows the number of equal parts taken of a whole quantity or unit  Fractions can be expressed.
Modified Gary Larson Far Side cartoon
1 Chapter 3 Matrix Algebra with MATLAB Basic matrix definitions and operations were covered in Chapter 2. We will now consider how these operations are.
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 4: Basic C Operators
Spreadsheets Objective 6.02
2 Explain advanced spreadsheet concepts and functions Advanced Calculations 1 Sabbir Saleh_Lecture_17_Computer Application_BBA.
MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.
Array Math.
1 M ATLAB Short Course. History of Calculator 2 3 Introduction to Matlab Matlab is short for Matrix Laboratory Matlab is also a programming language.
Introduction to MATLAB. Windows in MATLAB Command Window – where you enter data, run MATLAB code, and display results Command History - displays a log.
Matlab Chapter 2: Array and Matrix Operations. What is a vector? In Matlab, it is a single row (horizontal) or column (vertical) of numbers or characters.
 Input and Output Functions Input and Output Functions  OperatorsOperators Arithmetic Operators Assignment Operators Relational Operators Logical Operators.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
Introduction to MATLAB CBE 502 Mathematical Methods of Engineering Analysis.
Learner’s Guide to MATLAB® Chapter 2 : Working with Arrays.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
Introduction to Engineering MATLAB – 1 Introduction to MATLAB Agenda Introduction Arithmetic Operations MATLAB Windows Command Window Defining Variables.
ORDER OF OPERATIONS x 2 Evaluate the following arithmetic expression: x 2 Each student interpreted the problem differently, resulting in.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Basic Operators. What is an operator? using expression is equal to 9. Here, 4 and 5 are called operands and + is the operator Python language supports.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Performing Calculations—1 of 2 In addition to using queries to retrieve, update, sort, and filter data in a database, you can use a query to perform calculations.
15-Nov-15 All the Operators. operators.ppt 2 Precedence An operator with higher precedence is done earlier (precedes) one with lower precedence A higher.
1 ITN270 Advanced Internet Databases Lecture 02. Operators and Function Reference Topics: – Explain & Demonstrate How You Can Use MySQL Operators – Overview.
INTRODUCTION TO MATLAB MATLAB is a software package for computation in engineering, science, and applied mathemat-ics. It offers a powerful programming.
A string is an array of characters Strings have many uses in MATLAB Display text output Specify formatting for plots Input arguments for some functions.
Chapter 4 Controlling Execution CSE Objectives Evaluate logical expressions –Boolean –Relational Change the flow of execution –Diagrams (e.g.,
Lec-10 Manipulations of Matlab Matrices. Built-in functions The chapter will be covered quickly There are quite a few built-in functions in MATLAB – If.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Digital Image Processing Lecture 6: Introduction to M- function Programming.
Array Operations ENGR 1181 MATLAB 4.
Fall 2006AE6382 Design Computing1 Control Statements in Matlab Topics IF statement and Logical Operators Switch-Case Disp() vs fprintf() Input() Statement.
INTRODUCTION TO MATLAB Dr. Hugh Blanton ENTC 4347.
Operators & Expressions
Doing math In java.
MATLAB Constants, Variables & Expression Nafees Ahmed Asstt. Professor, EE Deptt DIT, DehraDun.
ECE 103 Engineering Programming Chapter 4 Operators Herbert G. Mayer, PSU CS Status 6/19/2015 Initial content copied verbatim from ECE 103 material developed.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Acc Math 2 Today’s Question: How do you perform operations with functions? Standard: MM2A5.d.
ENG College of Engineering Engineering Education Innovation Center 1 Array Operations in MATLAB 1.Types of Matrix arithmetic 2.Dot operators Mathematical.
A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB.
Array and Matrix Operations Dr. Marco A. Arocha INGE3016-MATLAB Sep 11, 2007, Dic 7,
Relational and Logical Operators EE 201 1C7-2 Spring 2012.
Spreadsheet Calculations Formulas & Functions Computer Applications I.
Operators & Expressions
Vectors and Matrices Chapter 2 Attaway MATLAB 4E.
Vectorized Code, Logical Indexing
Introduction to MATLAB [Vectors and Matrices] Lab 2
Spreadsheets 2 Explain advanced spreadsheet concepts and functions
Vectors and Matrices Chapter 2 Attaway MATLAB 4E.
Spreadsheets Objective 6.02
Matlab Basics.
Spreadsheets Objective 6.02
Chapter 3: Selection Structures: Making Decisions
Presentation transcript:

A L I MAM M OHAMMAD B IN S AUD I SLAMIC U NIVERSITY C OLLEGE OF S CIENCES D EPARTMENT OF M ATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB

Complement on Matrix manipulation 1 Relational operations Example >> A=rand(4,3) >> B=(A>.2)&(A<0.8) >> C=A.*B >> D=(A~=A(1,1)) 2 Logical operations

I NTRODUCTION TO M ATLAB 3 Operator Precedence You can build expressions that use any combination of arithmetic, relational, and logical operators. Precedence levels determine the order in which MATLAB evaluates an expression. Within each precedence level, operators have equal precedence and are evaluated from left to right. The precedence rules for MATLAB operators are shown in this list, ordered from highest precedence level to lowest precedence level: 1. Parentheses () 2. Transpose (.'), power (.^), complex conjugate transpose ('), matrix power (^) 3. Unary plus (+), unary minus (-), logical negation (~) 4. Multiplication (.*), right division (./), left division(.\), matrix multiplication (*), matrix right division (/), matrix left division (\) 5. Addition (+), subtraction (-) 6. Colon operator (:) 7. Less than ( ), greater than or equal to (>=), equal to (==), not equal to (~=) 8. Element-wise AND (&) 9. Element-wise OR (|)

I NTRODUCTION TO M ATLAB >> a|b&c is similar to >> a|(b&c) >> A = [3 9 5]; >> B = [2 1 5]; >> C = A./B.^2 C = >> C = (A./B).^2 C = Built-in functions and(A,B) equivalent to A & B or(A,B) equivalent to A | B not(A) equivalent to ~A Returns 1 for a vector where all elements of the vector are true (nonzero), and 0 if all elements are not true all Returns 1 for a vector where any element of the vector is true (nonzero), and 0 if no elements are true. any Find indices and values of nonzero elementsfind Sort array elements in ascending or descending ordersort Note: The all and any functions ignore any NaN values in the input arrays

I NTRODUCTION TO M ATLAB >> X = [ ]; >> indices = find(X) >> find(X > 2) >> find(X == 0) >> X = [ ]; >> indices = find(X) >> find(X > 2) >> find(X == 0) Returns the mean values of the elements along different dimensions of an array mean Returns the largest (smallest) element along different dimensions of an array max, min Return the sum of the elements along different dimensions of an array sum Calculates differences between adjacent elements of a vector diff Returns the products of the elements prod Returns the cumulative sum along different dimensions of an array. cumsum Returns the cumulative product along different dimensions of an array. cumprod 4 Some functions

I NTRODUCTION TO M ATLAB Examples >> a=rand(1,5) >> max(a) >> A=rand(3,6) >> max(A) >> max(max(A)) >> sort(a) >> sort(A) >> mean(a) >> mean(A) >> max(A) >> max(max(A)) >> a=rand(1,5) >> max(a) >> A=rand(3,6) >> max(A) >> max(max(A)) >> sort(a) >> sort(A) >> mean(a) >> mean(A) >> max(A) >> max(max(A))

I NTRODUCTION TO M ATLAB b returns the scalar product of the vectors a anddot(a,b) returns the cross product of the vectors a and b.cross(a,b) >> a = [1 2 3]; b = [4 5 6]; >> c = cross(a,b) >> d = dot(a,b)