Arrays, Vectors and Matrices

Introduction

1. These are basic elements in MATLAB as well as in control design theory.
2. A general matrix A may be written like this:

Forming a matrix

1. In MATLAB, vectors and matrices will be typed as:

2. To separate rows, semicolon “;” is used.
3. To separate columns, comma “,” or space “ ” is used.

Selecting matrix elements

To get specific part of a matrix, type as follows:

Forming matrix from 2 vectors

A matrix can also be created from 2 vectors X and Y as:

Colon Notation

It is very useful to create the vectors as:
x=[xi:dx:xf]
where, xi is starting value,
xf is final value, and
dx is increment.

Delete rows and columns

Rows and columns can be deleted from a matrix using just a pair of square brackets [].

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s