# lecture1 - Introduction to MATLAB 1. Basic Operators:...

This preview shows pages 1–4. Sign up to view the full content.

Introduction to MATLAB 1. Basic Operators: Arithmetic operators: + - * / Relational operators: == = > < > = < = (equal) (unequal) Logical operators: || (and) (or) (not) Example: a = 2 a > a < = 2 a 2 a > a < 1 a == 1 a > 0 || a < 1 a = 1 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2. Vectors and Matrices: vector: v = [ 1 , 2 , 3 ]; v = [ 1 2 3 ]; v = 1 : 1 : 3 ; v = 1 : 3 ; Matrix: A = [ 1 2 3 ; 4 , 5 , 6 ]; A = [ 1 , 2 , 3 4 , 5 , 6 ] 2
Some MATLAB build-in functions: – length (v): returns the length of vector v. – size (A): return the number of rows and columns in the matrix A. – zeros (n,m): generates an n-by-m matrix of zeros. – ones (n,m): generates an n-by-m matrix of ones. – eye (n): generates the n-by-n identity matrix. – linspace (x,y): generates a row vector of 100 linearly equally spaced points between x and y. – linspace (x,y,n): generates n points between x and y. Example:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 05/11/2011 for the course MATH 300 taught by Professor Sheng during the Spring '11 term at ITT Tech Pittsburgh.

### Page1 / 11

lecture1 - Introduction to MATLAB 1. Basic Operators:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online