CMPS 1371 Introduction to Computing for Engineers VECTORS.

Slides:



Advertisements
Similar presentations
2.3 Modeling Real World Data with Matrices
Advertisements

CIS 101: Computer Programming and Problem Solving Lecture 2 Usman Roshan Department of Computer Science NJIT.
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Lecture 2 MATLAB fundamentals Variables, Naming Rules, Arrays (numbers, scalars, vectors, matrices), Arithmetical Operations, Defining and manipulating.
EGR 106 – Week 3 – More on Arrays Brief review of last week Additional ideas: – Special arrays – Changing an array – Some array operators – Character arrays.
Matrix Mathematics in MATLAB and Excel
Matrices The Basics Vocabulary and basic concepts.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
Warm-up 1.Review notes from Friday. 2.What is the dimension of the matrix below?
Chapter 7 Matrix Mathematics Matrix Operations Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
4.2 Operations with Matrices Scalar multiplication.
1 Introduction to MATLAB MATLAB is all of the following: 1.Computational environment 2.Plotting software 3.Programming language Typical applications: 1.Calculations.
MATLAB INTRO CONTROL LAB1  The Environment  The command prompt Getting Help : e.g help sin, lookfor cos Variables Vectors, Matrices, and Linear Algebra.
MATLAB Tutorials Session I Introduction to MATLAB Rajeev Madazhy Dept of Mechanical Engineering LSU.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
CSE123 Lecture 5 Arrays and Array Operations. Definitions Scalars: Variables that represent single numbers. Note that complex numbers are also scalars,
Arrays 1 Multiple values per variable. Why arrays? Can you collect one value from the user? How about two? Twenty? Two hundred? How about… I need to collect.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
MATLAB An Introduction to MATLAB (Matrix Laboratory) 1.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161.
Matlab for Engineers Manipulating Matlab Matrices Chapter 4.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Working with Arrays in MATLAB
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
Array Creation ENGR 1181 MATLAB 2. Civil engineers store seismic data in arrays to analyze plate tectonics as well as fault patterns. These sets of data.
Array Creation ENGR 1187 MATLAB 2. Today’s Topics  Arrays: What are they?  Vectors  Matrices  Creating Arrays.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
Algebra Matrix Operations. Definition Matrix-A rectangular arrangement of numbers in rows and columns Dimensions- number of rows then columns Entries-
Matlab for Engineers Matlab Environment Chapter 2.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
MATRIX A set of numbers arranged in rows and columns enclosed in round or square brackets is called a matrix. The order of a matrix gives the number of.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Manipulating MATLAB Vector, Matrices 1. Variables and Arrays What are variables? You name the variables (as the programmer) and assign them numerical.
Project Teams Project on Diffusion will be a TEAM project. 34 Students in class so 6 teams of 5 and one Team of 4. Determine members of team and a team.
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Ch. 12 Vocabulary 1.) matrix 2.) element 3.) scalar 4.) scalar multiplication.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
ECE 1304 Introduction to Electrical and Computer Engineering
12-1 Organizing Data Using Matrices
Matrix. Matrix Matrix Matrix (plural matrices) . a collection of numbers Matrix (plural matrices)  a collection of numbers arranged in a rectangle.
ECE 1304 Introduction to Electrical and Computer Engineering
Matrix Operations Free powerpoints at
Manipulating MATLAB Matrices Chapter 4
Matrix Operations.
Matrix Operations Free powerpoints at
Matrix Operations Monday, August 06, 2018.
Matrix Operations.
Matrix Operations SpringSemester 2017.
Matrix Operations Free powerpoints at
WarmUp 2-3 on your calculator or on paper..
Use of Mathematics using Technology (Maltlab)
4.1 Matrices – Basic Operations
MATRICES MATRIX OPERATIONS.
2.2 Introduction to Matrices
Communication and Coding Theory Lab(CS491)
Array Creation ENGR 1181 MATLAB 02.
Matlab Training Session 2: Matrix Operations and Relational Operators
EECS Introduction to Computing for the Physical Sciences
1.8 Matrices.
What is the dimension of the matrix below?
Matrix Operations SpringSemester 2017.
1.8 Matrices.
Presentation transcript:

CMPS 1371 Introduction to Computing for Engineers VECTORS

ARRAYS The real strength of Matlab is in matrix manipulations Arrays are homogeneous collection of things. All are the same Are indexable

VECTORS Our simplest array type is called a vector. Simple example: ODDS = [ ] To index a vector, need to know the position within the vector: First element has position 1 (NOT ZERO!) ODDS(1) = 1 Last element: either the length of the array or the special label ‘end’ ODDS(8) = 15 ODDS(end) = 15

Create a Vector To create a row vector, enclose a list of values in brackets

Create a Vector You may use either a space or a comma as a “delimiter” in a row vector

Create a Vector Use a semicolon as a delimiter to create a new row

Shortcuts While a complicated matrix might have to be entered by hand, evenly spaced matrices can be entered much more readily. The command b= 1:5 or the command b = [1:5] both return a row matrix

The default increment is 1, but if you want to use a different increment put it between the first and final values Increments

To calculate spacing Use linspace Initial value in the array Final value in the array number of elements in the array

Basic Functions Some basic functions: Consider temp = [ ] length(temp)=5 sum(temp)=15 mean(temp)=3 median(temp)=3

Calculations Matrices can be used in many calculations with scalars There is no confusion when we perform addition and subtraction Multiplication and division are a little different In matrix mathematics the multiplication operator (*) has a very specific meaning regarding Matrix multiplication We will use (.*) for matrix multiplication We can use (*) for scalar multiplication

Adding Vectors

Addition between arrays is performed on corresponding elements

Multiplying Vectors MATLAB interprets * to mean matrix multiplication. The arrays a and b are not the correct size for matrix multiplication in this example Multiplication between arrays is performed on corresponding elements if the.* operator is used

Array Operations Array multiplication.* Array division./ Array exponentiation.^ In each case the size of the arrays must match

Changing the Vector Easy to add elements to the array Temp = [ ]; Temp(5) = 8;  Temp now has 5 elements 1, 2, 3, 4, 8 Can also concatenate fred = [[1,2,3,4] [3,4,5,]] fred = [fred ] Can also remove elements by using the "Null" vector A = [ ] A(2) = [ ] – now what is A