Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
>> B=[1;3;4]
B=
1
3
4
>> C=[3 4 5]
C=
3
>> 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
>> q=[1 0 3 0]
q=
1
>>
>>
>>
>>
%calcular el polinomio
p=[1 5 8 1];
% evaluando en el punto 2
polyval(p,2)
ans =
45
>>
>>
>>
>>
%polinomio
p=[1 3 9 13];
%calculamos las raices
roots(p)
ans =
-0.5577 + 2.5665i
-0.5577 - 2.5665i
-1.8846
>> p=[1 -3 9 13];
>> roots(p)
ans =
2.0000 + 3.0000i
2.0000 - 3.0000i
-1.0000
>>
>>
>>
>>
ans =
1
-3
13
-1
-1
>> [c,r]=deconv(p1,p2)
c=
1
-3
r=
4
Rango de tiempo
>> t=[0:0.5:4]
t=
Columns 1 through 7
0
0.5000
1.0000
1.5000
Columns 8 through 9
3.5000
4.0000
20
30
>> v1+v2
ans =
5
>> v1.*v2
ans =
4
10
18
>> conv(v1,v2)
ans =
4
13
28
27
18
xlabel('tiempo(s)')
ylabel('y(t)')
title('senoide amortiguada')
plot(t,y,'r *')
grid
grid on
2.0000
2.5000
3.0000
>>
>>
>>
>>
>>
>>
%funcion fplot
fplot('10*exp(-t).*sin(5*t)',[0,10])
grid on
xlabel('tiempo(s)')
title('senoide amortiguada')
ylabel('y(t)')
>>
>>
>>
>>
>>
%graficas
t=[0:pi/180:4*pi]; %intervalos
y1=sin(t);
y2=cos(t);
plot(t,y1,'r o',t,y2,'g -')
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
t=0:0.1:10;
subplot(2,2,1)
y1=exp(-t);
plot(t,y1)
subplot(2,2,2)
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