Today is : Saturday, 04 Sep 2010
>>     Home Matlab Basics for Powersystem Lab
Matlab Basics for Powersystem Lab
Matlab Basics for Powersystem Lab - Vectors PDF Print E-mail
Tuesday, 03 November 2009 06:34
Article Index
Matlab Basics for Powersystem Lab
Vectors
Functions
Plottings
Polynomials
Matrices
Using M-files in Matlab
Getting help in Matlab
All Pages

VECTORS

Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between brackets, and set it equal to a variable. For example, to create the vector a, enter into the Matlab command window (you can "copy" and "paste" from your browser into Matlab to make it easy):


a = [1 2 3 4 5 6 9 8 7]
Matlab should return:

a =
   1 2 3 4 5 6 9 8 7

Let's say you want to create a vector with elements between 0 and 20 evenly spaced in increments of 2 (this method is frequently used to create a time vector):

t = 0:2:20

t =
   0 2 4 6 8 10 12 14 16 18 20

Manipulating vectors is almost as easy as creating them. First, suppose you would like to add 2 to each of the elements in vector 'a'. The equation for that looks like:

b = a + 2
b =
    3 4 5 6 7 8 11 10 9

Now suppose, you would like to add two vectors together. If the two vectors are the same length, it is easy. Simply add the two as shown below:

c = a + b
c =
    4 6 8 10 12 14 20 18 16

Subtraction of vectors of the same length works exactly the same way.



Last Updated on Tuesday, 03 November 2009 07:38
 
Request to all Stamford EEE brothers- please submit your class notes for your junior brothers
"Be senior brother in your works!"
Uploaded Notes by the EEE students of Stamford
* DC Generator
* VLSI-I Lab Reports
* Bangladesh Studies
* Control System Solutions
* Control System Lab Reports
* Power System Assignment - 01
* Power System Assignment - 02