EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers.

Slides:



Advertisements
Similar presentations
Section 13-4: Matrix Multiplication
Advertisements

MATLAB – A Computational Methods By Rohit Khokher Department of Computer Science, Sharda University, Greater Noida, India MATLAB – A Computational Methods.
Introduction to Matlab
Introduction to MATLAB for Biomedical Engineering BME 1008 Introduction to Biomedical Engineering FIU, Spring 2015 Lesson 2: Element-wise vs. matrix operations.
R Lecture 4 Naomi Altman Department of Statistics Department of Statistics (Based on notes by J. Lee)
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 20P. 1Winter Quarter Propulsion Lab with MATLAB Lecture 20.
Lecture 7 Debugging Code & Data Import/Export © 2007 Daniel Valentine. All rights reserved. Published by Elsevier.
Maths for Computer Graphics
Introduction to Matlab. I use Matlab for: Data analysis Data plotting Image Analysis Also – Simulations (solving odes/pdes/finite element methods) – Minimisations,
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
Matrices and arrays Pekar Miriam. What is matrices? In MATLAB environment, a matrix is a rectangular array of number Vector - 1 by 1 row/ column matrix.
Introduction to MATLAB Northeastern University: College of Computer and Information Science Co-op Preparation University (CPU) 10/22/2003.
Getting started with Matlab Numerical Methods Appendix B help/techdoc/learn_matlab/learn_matlab.html.
Division Example 2x - 3y + 4z = 10 x + 6y - 3z = 4 -5x + y + 2z = 3 A*X = B where A = B = >> X = A\B X =
Matlab Basics IEF 217a: Lecture 2 Fall 2002 Sigmon and Davis, chapters 1-7.
Introduction to MATLAB
CE 311 K - Introduction to Computer Methods Daene C. McKinney
1 Chapter 2 Matrices Matrices provide an orderly way of arranging values or functions to enhance the analysis of systems in a systematic manner. Their.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 21P. 1Winter Quarter MATLAB: Structures.
MEGN 536 – Computational Biomechanics MATLAB: Getting Started Prof. Anthony J. Petrella Computational Biomechanics Group.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation tools. Others include Maple Mathematica MathCad.
Matlab Programming for Engineers Dr. Bashir NOURI Introduction to Matlab Matlab Basics Branching Statements Loops User Defined Functions Additional Data.
Chapter 4 Review: Manipulating Matrices Introduction to MATLAB 7 Engineering 161.
10/24/20151 Chapter 2 Review: MATLAB Environment Introduction to MATLAB 7 Engineering 161.
MATLAB Environment ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Matlab Basics FIN250f: Lecture 3 Spring 2010 Grifths Web Notes.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Introduction to MATLAB 7 for Engineers William J. Palm.
Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz SUNY-New Paltz “Lecture 2”
EGR 115 Introduction to Computing for Engineers Introduction to MATLAB Friday 29 August 2014 EGR 115 Introduction to Computing for Engineers.
EGR 115 Introduction to Computing for Engineers Formatted File Input / Output Wednesday 12 Nov 2014 EGR 115 Introduction to Computing for Engineers.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 4: Intro to Plotting Wednesday 10 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 2: Sub-Arrays Friday 05 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to Matlab  Matlab is a software package for technical computation.  Matlab allows you to solve many numerical problems including - arrays.
How to Multiply Two Matrices. Steps for Matrix Multiplication 1.Determine whether the matrices are compatible. 2.Determine the dimensions of the product.
EGR 115 Introduction to Computing for Engineers Designing The Battleship Game in MATLAB Monday 22 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to MATLAB Zongqiang Liao Research Computing Group UNC-Chapel Hill.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 6: Debugging in MATLAB Monday 15 Sept 2014 EGR 115 Introduction to Computing for Engineers.
INTRODUCTION TO MATLAB DAVID COOPER SUMMER Course Layout SundayMondayTuesdayWednesdayThursdayFridaySaturday 67 Intro 89 Scripts 1011 Work
EGR 115 Introduction to Computing for Engineers MATLAB Basics 5: Applications – Vector Math Friday 12 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
BRIAN D. HAHN AND DANIEL T. VALENTINE THIRD EDITION Essential MATLAB® for Engineers and Scientists.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 20P. 1Winter Quarter Propulsion Lab with.
CSE 455 : Computer Vision MATLAB 101 Getting Started with MATLAB.
Math 252: Math Modeling Eli Goldwyn Introduction to MATLAB.
Matrix Multiplication The Introduction. Look at the matrix sizes.
EGR 115 Introduction to Computing for Engineers Loops and Vectorization – Part 3 Friday 17 Oct 2014 EGR 115 Introduction to Computing for Engineers.
SUNY-New Paltz Computer Simulation Lab Electrical and Computer Engineering Department SUNY – New Paltz “Lecture 11”
4.1 An Introduction to Matrices Katie Montella Mod. 6 5/25/07.
An Introduction to Programming in Matlab Emily Blumenthal
Beginning Programming for Engineers Animation. Special matrix functions >> clear >> ones(2,3) >> zeros(3,5) >> ones(2) >> zeros(3) >> eye(4) >> magic(4)
Introduction to Matlab
ECE 1304 Introduction to Electrical and Computer Engineering
EGR 115 Introduction to Computing for Engineers
EGR 115 Introduction to Computing for Engineers
EGR 115 Introduction to Computing for Engineers
Functions (subprograms)
MATLAB DENC 2533 ECADD LAB 9.
funCTIONs and Data Import/Export
ARRAY DIVISION Identity matrix Islamic University of Gaza
Introduction to MATLAB
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Matlab Training Session 2: Matrix Operations and Relational Operators
ME 123 Computer Applications I Lecture 5: Input and Output 3/17/03
Presentation transcript:

EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers

Lecture Outline Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Data files, Array Operations, and Some of the built in functions Slide 2 of 10

MATLAB basics Data files: Saving data Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Often as engineers we will need to save the results of an analysis task or load data from a test procedure. MATLAB allows data to be saved from a session >> save filename var1 var2 var3 o A file called “filename.mat” will be created – This is a compact binary data file (not human readable) o Var1 and Var2 refer to variables in the workspace  It is also possible to save to an ASCII data file (human readable)ASCII >> save filename.txt var1 var2 -ascii Slide 3 of 10

Creates the file “my_data.mat” in your current working directory MATLAB basics Data files: Loading data from files Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers The load function is the complement of save and can retrieved data from a file >> load filename.mat An example: >> a = [ ];% variable 1 >> b = [4; 8];% variable 2 >> save my_data a b;% Save variables ‘a’ and ‘b’ >> clear all;% Clear the workspace >> load my_data;% Load the variables from the file o Note that the variables are removed from the workspace and reappear after being loaded!! Slide 4 of 10 Try saving both a and b to “my_data.txt” as an ascii file – Open the file

MATLAB basics Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Array Addition (c = a + b)  Only makes sense if ‘a’ and ‘b’ are the same size  An Example: Slide 5 of 10 Col index Row index

MATLAB basics Array Operations - Multiplication Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Array Multiplication (c = a * b)  Only makes sense if ‘a’ and ‘b’ are compatible o Number of columns of ‘a’ must be the same as the number of rows of ‘b’ – A nXm matrix times a mXr matrix yields a nXr matrix  An Example: (a is a 2X3 matrix and ‘b’ a 3X4, thus ‘c’ is 2X4) Slide 6 of 10 What is the result of: >> c = b * a ??? Create two square matrices ‘a’ & ‘b’: Is a* b = b * a ?

MATLAB basics Array Operations – Element by Element Multiplication Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Element by Element Array Multiplication (c = a.* b)  Only makes sense if ‘a’ and ‘b’ are exactly the same size  An Example: (a is a 2X3 matrix and ‘b’ a 2X3, thus ‘c’ is 2X3) Slide 7 of 10

MATLAB basics Array Operations – Matrix Division? Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Slide 8 of 10 What is the result of: >> c = inv(b) * a ???

MATLAB basics Some of the built in Functions Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Slide 9 of 10

MATLAB basics Some of the built in Functions Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Slide 10 of 10 Some of the built in functions

Next Lecture Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers Intro to Plotting Slide 11 of 10