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.

Slides:



Advertisements
Similar presentations
Problems and solutions Session 3. Introduction to MATLAB - Solutions 3 Problems 1. Write function Xn = mspolygon(X,x0,a) that scales the INPUT polygon.
Advertisements

Introduction to MATLAB The language of Technical Computing.
Introduction to Matlab
Introduction to Matlab Workshop Matthew Johnson, Economics October 17, /13/20151.
MATLAB – What is it? Computing environment / programming language Tool for manipulating matrices Many applications, you just need to get some numbers in.
MATLAB Examples. CS 1112 MATLAB Examples Find the number of positive numbers in a vector x = input( 'Enter a vector: ' ); count = 0; for ii = 1:length(x),
Maths for Computer Graphics
Soft Computing 1 Matlab Tutorial Kai Goebel, Bill Cheetham RPI/GE CRD
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
MATLAB FOR PATTERN RECOGNITION By: Özge Öztimur. How Much Do We Know? Anybody who has never used MATLAB?
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Arithmetic Operations on Matrices. 1. Definition of Matrix 2. Column, Row and Square Matrix 3. Addition and Subtraction of Matrices 4. Multiplying Row.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Determinants 2 x 2 and 3 x 3 Matrices. Matrices A matrix is an array of numbers that are arranged in rows and columns. A matrix is “square” if it has.
1 MATLAB 基礎. 2 MATLAB  Workspace: environment (address space) where all variables reside  After carrying out a calculation, MATLAB assigns the result.
January 24, 2005 Lecture 3 - By P. Lin 1 CPET 190 Lecture 3 Problem Solving with MATLAB
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
Matlab tutorial course Lesson 2: Arrays and data types
Martin Ellison University of Warwick and CEPR Bank of England, December 2005 Introduction to MATLAB.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Nonparametric Econometrics1 Intro to Matlab for Data Analysis and Statistical Modeling.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
1 Lab 2 of COMP 319 Lab tutor : Shenghua ZHONG Lab 2: Sep. 28, 2011 Data and File in Matlab.
Lecture 2 - Matlab Introduction CVEN 302 June 5, 2002.
Introduction to MATLAB Session 1 Simopekka Vänskä, THL 2010.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
Matlab Screen  Command Window  type commands  Current Directory  View folders and m-files  Workspace  View program variables  Double click on a.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
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”
Meeting 18 Matrix Operations. Matrix If A is an m x n matrix - that is, a matrix with m rows and n columns – then the scalar entry in the i th row and.
Lecture 20: Choosing the Right Tool for the Job. What is MATLAB? MATLAB is one of a number of commercially available, sophisticated mathematical computation.
(The Transpose Operator) 1 >> C=[ ; ; ] C = >> D=C' D =
Introduction to Matlab Part II 1Daniel Baur / Introduction to Matlab Part II Daniel Baur / Michael Sokolov ETH Zurich, Institut für Chemie- und Bioingenieurwissenschaften.
3.6 Solving Systems Using Matrices You can use a matrix to represent and solve a system of equations without writing the variables. A matrix is a rectangular.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 3: Array Operations Monday 08 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
The Hong Kong Polytechnic University Industrial Centre MatLAB Lesson 1 : Overview & Environment Edward Cheung Room W311g.
Introduction to MATLAB 1.Basic functions 2.Vectors, matrices, and arithmetic 3.Flow Constructs (Loops, If, etc) 4.Create M-files 5.Plotting.
September 15, 2005 Lecture 5 - By Paul Lin 1 CPET 190 Lecture 5 Problem Solving with MATLAB
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.
1.7 Linear Independence. in R n is said to be linearly independent if has only the trivial solution. in R n is said to be linearly dependent if there.
CSE 455 : Computer Vision MATLAB 101 Getting Started with MATLAB.
Array Accessing and Strings ENGR 1187 MATLAB 3. Today's Topics  Array Addressing (indexing)  Vector Addressing (indexing)  Matrix Addressing (indexing)
Handling Arrays 1/2 Numerical Computing with. MATLAB for Scientists and Engineers.
Intro to Matlab Yipei Wang & Qihui Li {yipeiw,
Introduction to Programming on MATLAB Ecological Modeling Course Sep 11th, 2006.
Table of Contents Matrices - Definition and Notation A matrix is a rectangular array of numbers. Consider the following matrix: Matrix B has 3 rows and.
Matlab Tutorial Iman Moazzen First Session – September 11, 2013.
การใช้งานโปรแกรม MATLAB ดร. อำนาจ ขาวเน. BASIC ELEMENTS OF MATLAB MATLAB Desktop MATLAB Editor Help System MATLAB (MATrix LABoratory)
Machine Learning Octave tutorial 데이터 마이닝 박 영 택.
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)
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
What is Matlab?  “MATLAB® is a high-level language and interactive environment for numerical computation, visualization, and programming. Using MATLAB,
Introduction Types of Matrices Operations
Matrices and systems of Equations. Definition of a Matrix * Rectangular array of real numbers m rows by n columns * Named using capital letters * First.
Linear Algebra review (optional)
Prof. Mark Glauser Created by: David Marr
1.5 Matricies.
EGR 115 Introduction to Computing for Engineers
Matrices and Data Holt Algebra 2.
Matlab Workshop 9/22/2018.
Matlab tutorial course
Matrix Definitions It is assumed you are already familiar with the terms matrix, matrix transpose, vector, row vector, column vector, unit vector, zero.
Matrices and Data Holt Algebra 2.
Linear Algebra review (optional)
Matrix A matrix is a rectangular arrangement of numbers in rows and columns Each number in a matrix is called an Element. The dimensions of a matrix are.
Presentation transcript:

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

Creating matrices matr1=[1 2] matr2=[2 4,4 5] matr2 = Check lines ; matr[] – empty matrix matr = matr3=[3 4;2 3] matr3 = matr1=[1 2] matr1 = 1 2 matr2=[2 4,4 5] matr3=[3 4;2 3] matr4=[2^4,3, 5,4*6+5, 7,[2,3]]

Creating matrices with functions We need to definite the variables first! >> matr_by_matr=[matr_by_vec,2*matr_by_vec] matr_by_matr = >> vec=[1 3 5] vec = >> matr_by_vec=[vec;4+2*vec] matr_by_vec =

Matrices length >> vec=[2 4 5; 4 7 6]; >> [row,col]=size(vec)‏ row = 2 col = 3 Vector length >> vec=[2 4 6]; >> L=length(vec)‏ L = 3

Function rand creating random matrices >> rand_mat=rand(2,0)‏ >> rand_mat=rand(2)‏ >> rand_mat=rand(2,3)‏ Fix - Round toward Zero - >> a=[ ; ; ]; >> fix(a); Randn – random with negative digits rand_mat = rand_mat = rand_mat = Empty matrix: 2-by-0

Indexing into a matrix a(1:2,3:4)=[3 6;8 4] Changing Matrix cells till last cell – with “end” - A(:,end)=[1;2;3;4;5]; Changing value of cell 10 a(1,1)=10 : - changing all cells a(:,3)=1 1 1 Changing a sub matrix

The load function 1 File -> open -> data.dat Create a data.dat file

File -> new -> M-Files M-Files >> data >> whos Name Size Bytes Class Attributes A 2x3 48 double Save in your directory Call to the file The load function 2

Workspace Easy watch all vectors and Matrices ans – Optional Variable Matr=zeros(row,col)‏ Matr=ones(row,col)‏ Transpose ‘ change row matrix to column matrix