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.

Slides:



Advertisements
Similar presentations
Variables i)Numeric Variable ii)String Variable
Advertisements

Maths for Computer Graphics
General Computer Science for Engineers CISC 106 Lecture 04 Roger Craig Computer and Information Sciences 9/11/2009.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
CIS 101: Computer Programming and Problem Solving Lecture 2 Usman Roshan Department of Computer Science NJIT.
EGR 106 – Week 2 – Arrays Definition, size, and terminology Construction methods Addressing and sub-arrays Some useful functions for arrays Character arrays.
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.
1 Matrix Addition, C = A + B Add corresponding elements of each matrix to form elements of result matrix. Given elements of A as a i,j and elements of.
Matlab Intro. Outline Matlab introduction Matlab elements Types Variables Matrices.
General Computer Science for Engineers CISC 106 Lecture 08 James Atlas Computer and Information Sciences 9/21/2009.
Lecture 7: Matrix-Vector Product; Matrix of a Linear Transformation; Matrix-Matrix Product Sections 2.1, 2.2.1,
Intro to Matrices Don’t be scared….
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
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.
4.1 Using Matrices to Represent Data
Portfolio Statistics  Portfolio Expected Return: E(r p ) = w T r  Portfolio Variance:  2 p = w T  w  Sum of portfolio weights: = w T 1 –where w is.
MATLAB Lecture One Monday 4 July Matlab Melvyn Sim Department of Decision Sciences NUS Business School
You can make this in matlab!. Matlab Introduction and Matrices.
1 Week 3: Vectors and Matrices (Part III) READING: 2.2 – 2.4 EECS Introduction to Computing for the Physical Sciences.
Array Addition  Two arrays can be added if and only if both arrays have exactly the same dimensions.  Assuming the dimension requirement is satisfied,
ECE 1304 Introduction to Electrical and Computer Engineering Section 1.1 Introduction to MATLAB.
CMPS 1371 Introduction to Computing for Engineers MATRICES.
Lecture 28: Mathematical Insight and Engineering.
MATLAB Basics. The following screen will appear when you start up Matlab. All of the commands that will be discussed should be typed at the >> prompt.
Matrices. Definitions  A matrix is an m x n array of scalars, arranged conceptually as m rows and n columns.  m is referred to as the row dimension.
13.1 Matrices and Their Sums
Introduction to Matlab Module #2 Page 1 Introduction to Matlab Module #2 – Arrays Topics 1.Numeric arrays (creation, addressing, sizes) 2.Element-by-Element.
Lesson 11-1 Matrix Basics and Augmented Matrices Objective: To learn to solve systems of linear equation using matrices.
4.6: Rank. Definition: Let A be an mxn matrix. Then each row of A has n entries and can therefore be associated with a vector in The set of all linear.
ENG College of Engineering Engineering Education Innovation Center 1 Array Accessing and Strings in MATLAB Topics Covered: 1.Array addressing. 2.
>> x = [ ]; y = 2*x y = Arrays x and y are one dimensional arrays called vectors. In MATLAB all variables are arrays. They allow functions.
Chapter 6 Systems of Linear Equations and Matrices Sections 6.3 – 6.5.
ES 240: Scientific and Engineering Computation. Chapter 8 Chapter 8: Linear Algebraic Equations and Matrices Uchechukwu Ofoegbu Temple University.
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.
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.
Digital Image Processing Introduction to MATLAB. Background on MATLAB (Definition) MATLAB is a high-performance language for technical computing. The.
Introduction to Engineering MATLAB – 4 Arrays Agenda Creating arrays of numbers  Vectors: 1-D Arrays  Arrays: 2-D Arrays Array Addressing Strings & String.
Chapter 1 Section 1.5 Matrix Operations. Matrices A matrix (despite the glamour of the movie) is a collection of numbers arranged in a rectangle or an.
EGR 115 Introduction to Computing for Engineers MATLAB Basics 1: Variables & Arrays Wednesday 03 Sept 2014 EGR 115 Introduction to Computing for Engineers.
Find the determinate of both of the following matrices.
1 Faculty Name Prof. A. A. Saati. 2 MATLAB Fundamentals 3 1.Reading home works ( Applied Numerical Methods )  CHAPTER 2: MATLAB Fundamentals (p.24)
Intro to Matlab Yipei Wang & Qihui Li {yipeiw,
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.
The Matrix Equation A x = b (9/16/05) Definition. If A is an m  n matrix with columns a 1, a 2,…, a n and x is a vector in R n, then the product of A.
Matrix Algebra Definitions Operations Matrix algebra is a means of making calculations upon arrays of numbers (or data). Most data sets are matrix-type.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
A rectangular array of numeric or algebraic quantities subject to mathematical operations. The regular formation of elements into columns and rows.
Section 6-2: Matrix Multiplication, Inverses and Determinants There are three basic matrix operations. 1.Matrix Addition 2.Scalar Multiplication 3.Matrix.
ENG College of Engineering Engineering Education Innovation Center 1 Arrays in MATLAB Topics Covered: 1.Creating arrays of numbers vectors matrices.
Matrices. Matrix A matrix is an ordered rectangular array of numbers. The entry in the i th row and j th column is denoted by a ij. Ex. 4 Columns 3 Rows.
LAB 2 Vectors and Matrices Dr.Abdel Fattah FARES.
MTH108 Business Math I Lecture 20.
Matrix Operations.
Unit 1: Matrices Day 1 Aug. 7th, 2012.
Matrix Operations.
Matrix Operations.
Matrices and Data Holt Algebra 2.
2. Matrix Algebra 2.1 Matrix Operations.
4.6: Rank.
Fourth Year – Software Engineering
Matrix Addition
Matlab Basic Dr. Imtiaz Hussain
Matrices and Data Holt Algebra 2.
3.5 Perform Basic Matrix Operations
Introduction to Matlab:
Chapter 4 Matrices & Determinants
Presentation transcript:

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 and press enter. 4

Some Basic Commands 5

Some Basic Commands (contd…) 6

7

8

9

Types of MATLAB Variables 10

Defining Scalars 11

Variable Definitions 12

Variable Definitions 13

Arithmetic Operators on Scalars 14 MATLAB utilizes the following arithmetic operators:

Variable Definition (Contd…….) 15

Variables in Workspace Type who to check the stored variables in workspace. 16

Variables in Workspace Type whos to check the stored variables in long form. 17

Complex numbers A complex number 3+2i in Matlab is entered in the following form 18

Complex numbers An exponential number 3x10 -2 in Matlab is entered in the following form 19

Exercise#1 Investigate the effect of following commands 20

Defining Vectors 21

Defining Row Vectors 22 To create a row vector A simply type in: A = [ ] A(5) A(2)

Defining Row Vectors 23 v = [ ] A(6:9) A(1:4)

Defining Column Vectors 24 To create a column vector B simply type in: B = [3; 5; 0; 0; 1; 4; 9; -1; 1] B =9x1 vector B(5) B(3)

Defining Column Vectors 25 B = [3; 5; 0; 0; 1; 4; 9; -1; 1] x1 vector B(7:9) B(2:5) B =

Arithmetic Operators (Arrays) 26

Exercise#2 27 Investigate the effect of the following commands: V=[ ] and w=[ ]

Exercise#3 28 Investigate the effect of the following commands. z=[1; 1; 0; 0]

Defining Matrices 29 A Matrix is a mxn array

Defining Matrices 30 To enter the matrix The most obvious ways are to type

Defining Matrices N = N(1,3) or N(9) N(4,3) or N(12) N=[ ; ; ; ]

Defining Matrices N = N(1:4) N(10:12) N=[ ; ; ; ]

Defining Matrices N = N(1:2,1:2) N(3:4,3:4)

Defining Matrices N = N(:,1:2)

Defining Matrices N = N(3:4,:)

Exercise#4 36 Investigate the effect of the following commands: M=[1 2; 3 4]N=[-1 3; 5 2]

Exercise#5 37 Investigate the effect of the following commands: M=[1 2; 3 4]

Exercise#6 1) Define a matrix A of dimension 2 x 4 whose (i,j) entry is A(i,j)=i+j 2) Extract two 2 x 2 matrices A1 and A2 out of the matrix A. A1 contains the first two columns of A, A2 contains the last two columns of A 3) Compute the matrix B to be the sum of A1 and A2 4) Compute the eigen values and eigen vectors of B 5) Compute the determinant of B 6) Compute the inverse of B 7) Compute the rank of B

Defining Character Arrays (Strings) 39 Character arrays are created using single quote delimiter

Defining Character Arrays (Strings)

Conversion B/W Numeric & String Arrays To convert from numeric to string array –num2str To convert from string array to numeric array –str2num 41

Numeric to string conversion 42

String to Numeric conversion 43

QUESTIONS Thank you for your concentration 44