Contents

Ejercicio 2

A=[4 -2 -10;2 10 -12;-4 -6 16];
b=[-10 32 -16]';
x=A\b
x =

    2.0000
    4.0000
    1.0000

Ejercicio 4

A=[0 1 -1;-6 -11 6;-6 -11 5];
[X,D]=eig(A);
fprintf('\n Autovectores (Columnas de la matriz)\n')
X(:,1)
fprintf('\n Autovalores (Diagonal)\n')
D
 Autovectores (Columnas de la matriz)

ans =

    0.7071
    0.0000
    0.7071


 Autovalores (Diagonal)

D =

   -1.0000         0         0
         0   -2.0000         0
         0         0   -3.0000

Ejercicio 5

Y=[1.5-2j -.35+1.2j;-.35+1.2j 0.9-1.6j];
I=[30+40j;20+15j]
V=Y\I
S=V.*conj(I)
I =

  30.0000 +40.0000i
  20.0000 +15.0000i


V =

   3.5902 +35.0928i
   6.0155 +36.2212i


S =

   1.0e+03 *

   1.5114 + 0.9092i
   0.6636 + 0.6342i

Ejercicio 6

%  function TorresHanoi(n,i,a,f)
%  if n>0
%      TorresHanoi(n-1, i, f, a);
%      fprintf('mover disco %d de %c a %c\n', n, i, f);
%      TorresHanoi(n-1, a, i, f);
%      end
% TorresHanoi (5,'a','b','c')

Ejercicio 7

x=0:0.5:5;
y=[10 10 16 24 30 38 52 68 82 96 123];
p=polyfit(x,y,2)
yc=polyval(p,x);
plot(x,y,'*',x,yc);
xlabel('x'),ylabel('y'),grid,title('Ajuste polinomico')
legend('Datos','Ajuste polinomico',2)
p =

    4.0233    2.0107    9.6783

Ejercicio 8

omegat=0:0.05:3*pi;
v=120*sin(omegat);
i=100*sin(omegat-(pi/4));
subplot(2,2,1)
plot(omegat,v,omegat,i)
title('Grafica Tensión e Intensidad'),xlabel('\omegat(radianes)')

p=v.*i;
subplot(2,2,2)
plot(omegat,p)
title('Potencia'),xlabel('\omegat (radianes)'),ylabel('watios')
Fm=3.0;
fa=Fm*sin(omegat);
fb=Fm*sin(omegat-2*pi/3);
fc=Fm*sin(omegat-4*pi/3);
subplot(2,2,3)
plot(omegat,fa,omegat,fb,omegat,fc)
title('Fm trifasico'),xlabel('\omegat (radianes)')

subplot(2,2,4)
fr=3.0;
plot(-fr*cos(omegat),fr*sin(omegat))
title('Radio fr')

Ejercicio 11

p=[1 0 -35 50 24];
r=roots(p)
r =

   -6.4910
    4.8706
    2.0000
   -0.3796

Ejercicio 12

function y = HalfSine(t, y, z)
h = sin(pi*t/5).*(t<=5);
y = [y(2); -2*z*y(2)-y(1)+h];
%Ejemploode
[t, yy] = ode45(@HalfSine, [0 35], [1 0], [ ], 0.15);
plot(t, yy(:,1))

Ejercicio 13

k = 5; m = 10; fo = 10;Bo = 2.5; N = 2^m; T = 2^k/fo;
ts = (0:N-1)*T/N; df = (0:N/2-1)/T;

g1 = Bo*sin(2*pi*fo*ts)+Bo/2*sin(2*pi*fo*2*ts);
An1 = abs(fft(g1, N))/N;
plot(df, 2*An1(1:N/2))

g2 = exp(-2*ts).*sin(2*pi*fo*ts);
An2 = abs(fft(g2, N))/N;
plot(df, 2*An2(1:N/2))

g3 = sin(2*pi*fo*ts+5*sin(2*pi*(fo/10)*ts));
An3 = abs(fft(g3, N))/N;
plot(df, 2*An3(1:N/2))

g4 = sin(2*pi*fo*ts-5*exp(-2*ts));
An4 = abs(fft(g4, N))/N;
plot(df, 2*An4(1:N/2))

Ejercicio 14

subplot(1,1,1)
A = imread('WindTunnel.jpg', 'jpeg');
image(A)
hold on
figure
r= A(200, :, 1);
plot(r, 'r');