You are on page 1of 6

PRACTICA NUMERO 2

REVISION DE FUNCIONES EN MATLAB

>> B=[1;3;4]
B=
1
3
4
>> C=[3 4 5]
C=
3

4

5

>> a=1;b=4;c=13;
>> %ECUACION DE SEGUNDO GRADO
>> 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
>> %POLINOMIOS
>> p=[2 7 1]
p=
2

7

1

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

0

3

0

%calcular el polinomio
p=[1 5 8 1];
% evaluando en el punto 2
polyval(p,2)

ans =

5665i -0.8846 >> p=[1 -3 9 13].r]=deconv(p1. %calculamos las raices roots(p) ans = -0.3. >> roots(p) ans = 2.p2) c= 1 -3 0 0 r= 4 Rango de tiempo >> t=[0:0.5665i -1.45 >> >> >> >> %polinomio p=[1 3 9 13].p2) ans = 1 -1 -1 1 >> [c.0000 >> >> >> >> %introducimos las raices raices=[-1 2+3i 2-3i].5577 .0000i -1.p2=[1 1].5577 + 2. %calculamos las raices poly(raices) ans = 1 -3 9 13 >> %declarar polinomios >> p1=[1 -2 1]. >> conv(p1.0000 + 3.0000i 2.0000 .5:4] .2.

0000 1.5000 1.0000 . v2=[4 5 6]. >> k*v1 ans = 10 20 30 >> v1+v2 ans = 5 7 9 >> v1.*v2 ans = 4 10 18 >> conv(v1.5000 3.y.0000 %introducimos datos del ejemplo >> k=10.Y) Undefined function or variable 'Y'.v2) ans = 4 13 28 27 18 >> %graficas de funciones >> >> t=[0:0.1:10]. %funcion >> plot(t.*sin(5*t).5000 4.5000 Columns 8 through 9 3.0000 2.'r *') grid grid on 2.% dominio >> y=10*exp(-t). v1=[1 2 3].t= Columns 1 through 7 0 0. >> >> >> >> >> >> xlabel('tiempo(s)') ylabel('y(t)') title('senoide amortiguada') plot(t.

y2. y2=cos(t).>> >> >> >> >> >> %funcion fplot fplot('10*exp(-t). %intervalos y1=sin(t). plot(t.t.'g -') .'r o'.[0.10]) grid on xlabel('tiempo(s)') title('senoide amortiguada') ylabel('y(t)') >> >> >> >> >> %graficas t=[0:pi/180:4*pi].y1.*sin(5*t)'.

plot(t.3) y3=exp(-t).y1) subplot(2. subplot(2.*exp(-t).1) y1=exp(-t).*cos(t).2. plot(t.y3) subplot(2.y4) grid on . plot(t.1:10.2) y2=t.4) y4=exp(t).2.y2) subplot(2.*cos(t).>> >> >> >> >> >> >> >> >> >> >> >> >> >> t=0:0. plot(t.2.2.