You are on page 1of 3

[Seleccione la fecha]

8 [Escriba el ttulo del documento]


Matlab para Ingenieros Parte 3

Vectores y Matrices
Transpuesta: Conversion de vector renglon a vector columna y viceversa
>> transpose (a) ; >> a (comilla)

Sumar o sustraer dos vectores ambos deben ser del mimo tipo
>> a= [ 5 ; 7 ]; b= [ 2 ; 2 ];
>> c=a+b
c =
7
9

Adjuntar vectores

>> U=[1;4;5];
>> V=[2;3;3];
>> W=[U;V]

W =
1
4
5
2
3
3
Vectores con elementos uniformemente espaciados
X= Xi : q : Xf Xi= valor inicial,
q=incremento
Xf=valor final
>> x= 0 : 2 : 10 %incremento positivo
x= 0 2 4 6 8 10
>> u= 100 : -5 : 80
u= 100 95 90 85 80 %incremento negativo
When the increase in MATLAB is not specified take default q = 1


[Seleccione la fecha]
9 [Escriba el ttulo del documento]
> > x = 0: 100
x = 0 1 2 3 4 5... 99 100
Linspace: vector line of 100 elements regularly spaced between a and b
> > linspace(a,b) vector line of 100 elements regularly spaced between a and b
> > linspace(a,b,n) vector space of n elements regularly spaced between a and b
> > linspace (0,10,4)
Ans =
0 3.3333 6.6667 10,0000
LOGSPACE (a, b, n): creates n spaced elements between
> > logspace (1,2,5)

Ans =

10,0000 17.7828 31.6228 56.2341 100,0000
It creates a line of n elements logarithmically spaced vector

Length (): Returns the number of elements contained in a vector
> > b = [3, 2];
> > length (b)

Ans =
2

Max () and min (): allows you to find items more large and small in a vector.
> > a = [3 6 9 0 - 1 7 15 2];
> > max (a)

Ans =
15

> > min (a)

Ans =
-1

Point product: product between two vectors


[Seleccione la fecha]
10 [Escriba el ttulo del documento]
> > a = [1; 4; 7];
> > b = [2; - 1; 5];
> > c = dot (a, b)
c =
33

You might also like