Está en la página 1de 7

PRACTICA N 2

NOMBRE: RICHARD FERNANDO PARRALES PALADINES


CURSO: 3ERO B de ELECTRICA
FECHA: 24/04/14
PROGRAMA HECHO EN MATLAB
A=[1 2 3; 3 4 5; 6 7 8]
A=
1
3
6

2
4
7

3
5
8

>> B= [1 2 3
B= [ 1 ; 2 ;3]
B= [ 1 ; 2 ;3]
|
Error: The expression to the left of the equals sign is not a valid target for an
assignment.
>> B= [ 1 ; 2 ;3]
B=
1
2
3
>> C = [ 1 2 3]
C=
1
>>
>>
>>
>>

% ECUACION DE SEGUNDO GRADO


a=1; b=4; c=13;
% FORMULA DE LA ECUACION
x1=(-b+sqrt(b^2-4*a*c))/(2*a)

x1 =
-2.0000 + 3.0000i
>> x2=(-b-sqrt(b^2-4*a*c))/(2*a)
x2 =
-2.0000 - 3.0000i

>> % OPERACIONES CON POLINOMIOS


>> p=[ 2 7 1 ]
p=
2

>> q = [ 1 0 3 0 ]
q=
1

>> %EVALUAR UN POLINOMIO


>> P= [ 1 5 8 1 ]
P=
1

>> polyval(P,2)
ans =
45
>> %RAICES DE UN POLINOMIO
>> p=[1 -3 9 13];
>> roots(p)
ans =
2.0000 + 3.0000i
2.0000 - 3.0000i
-1.0000
>> % RECONSTRUCCION DE UN POLINOMIO APARTIR DE LAS RAICES
>> raices=[-1 2+3i 2-3i];
>> poly(raices)
ans =
1

-3

13

>> % MULTIPLICAR Y DIVIDIR LOS POLINOMIOS


>> p1=[1 -2 1];p2=[ 1 1];
>> conv(p1,p2)
ans =
1

-1

-1

>> %division
>> [c,r]= deconv(p1,p2)

c=
1

-3

r=
4

>> %VELOCIDAD DE UN MOTOR


>> t=[0: 0.5 : 4]
t=
0
4.0000

0.5000

1.0000

1.5000

2.0000

2.5000

3.0000

3.5000

1.0000

1.5000

2.0000

2.5000

3.0000

3.5000

>> t=[0:0.5:4]
t=
0
4.0000
>>
>>
>>
>>

0.5000

% OPERACIONES CON VECTORES Y MATRICES


%k*v1
k=10;v1=[1 2 3];v2=[4 5 6];
k*v1

ans =
10

20

30

>> %v1+v2
>> v1+v2
ans =
5

>> %v1.*v2
>> v1.*v2
ans =
4

10

18

>> v1.^v2
ans =
1

32 729

>> %v1.^v2
>> v1.^v2
ans =
1

32 729

>> %REPRESENTACION GRAFICA DE FUNCIONES EN 2D Y EN 3D


>> %REPRESENTAR LA SENOIDE AMORTIGUADA
>> t=[0:0.1:10];
>> y=10*exp(-t)*sin(5*t);
Error using *
Inner matrix dimensions must agree.
>> y=10*exp(-t).*sin(5*t);
>> plot(t,y)
>> grid
>> xlabel('tiempo(s)')
>> ylabel('y(t)')
>> title('Senoide Amortiguada')
>> plot(t,y,'r')
>> plot(t,y,'r' *)
plot(t,y,'r' *)
|
Error: Unbalanced or unexpected parenthesis or bracket.
>> plot(t,y,'r *')
>> grid
>>
>>
>>
>>
>>
>>

%UTILIZANDO fplot
fplot('10*exp(-t).*sin(5*t)',[0;10])
grid
xlabel('tiempo(s)')
ylabel('y(t)')
title('Senoidal Amortiguada')

>> %GRAFICA
>> t=[0:pi/180:4*pi];
>> y1=sin(t);
>> y2=cos(t);
>> plot(t,yl,'r o',t,y2,'g-')
Undefined function or variable 'yl'.
>> plot(t,y1,'r o',t,y2,'g-')

>> %DISTINTAS VENTANAS


>> t=0:0.1:10;
>> subplot(2,2,1)
>> yl=exp(-t);
>> y1=exp(-t);
>> plot(t,y1)
>> subplot(2,2,2)
>> y2=t*exp(-t);
Error using *
Inner matrix dimensions must agree.
>>
>>
>>
>>
>>
>>
>>
>>
>>

y2=t.*exp(-t);
plot(t,y2)
subplot(2,2,3)
y3=exp(-t).*cos(t);
plot(t,y3)
subplot(2,2,4)
y4=exp(t).*cos(t);
plot(t,y4)
grid on

También podría gustarte