Wednesday, May 4, 2011

MATLAB

Basic matrix operationns
This is a demonstration of some aspects of matlab language:

first lets create a vector of 9 elements :
a= [1 2 3 4 6 4 3 4 5 ]
a=
1 2 3 4 6 4 3 4 5
Now let's add 2 to each element of our vector, a , and store the result in a new vector.
Notice how matlab requires no special handling of a vector or matrix math.
b= a + 2
b=
3 4 5 6 8 6 5 6 7
creteating a graph on matlab is easy as one command. let's plot the result of our vector addition to grid lines.
plot(b)
grid on

1 comment:

  1. So, what do we learn from your post?? By adding 2, what happens??

    ReplyDelete