Contents

Practica Matlab, Informatica Industrial y Comunicaciones

%Autor: Pablo Prieto López
%Fecha: 25/11/2017

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 matriz) \n')
X(:,1)
fprintf('\n Autovectores (Diagonal) \n')
D
 Autovectores (Columnas matriz) 

ans =

    0.7071
    0.0000
    0.7071


 Autovectores (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 hanoi(n,i,a,f)
%    if n>0
%        hanoi (n-1,i,f,a);
%        fprintf('mover disco "d" de "c" a "c"\n', n, i, f);
%        hanoi(n-1,a,i,f);
%    end
 hanoi (5,'a','b','c')
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "c"
mover disco "d" de "c" a "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

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

p=v.*i;
subplot(2,2,2)
plot(omt,p)
title('Potencia'),xlabel('\omt(radianes)'),ylabel('watios')

Fm=3.0;
fa=Fm*sin(omt);
fb=Fm*sin(omt-2*pi/3);
fc=Fm*sin(omt-4*pi/3);
subplot(2,2,3)
plot(omt,fa,omt,fb,omt,fc)
title('Trifasico'),xlabel('\omt(radianes)')

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

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;
figure(2);
plot(df, 2*An1(1:N/2))

g2 = exp(-2*ts).*sin(2*pi*fo*ts);
An2 = abs(fft(g2, N))/N;
figure(3);
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;
figure(4)
plot(df, 2*An3(1:N/2))

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

Ejercicio 14

figure(6)
subplot(1,1,1)
A = imread('WindTunnel.jpg', 'jpeg');
image(A)
hold on
figure(7)
r= A(200, :, 1);
g=A(200,:,2);
bl=A(200,:,3);
subplot(2,1,1)
plot(r, 'r');
subplot(2,1,2)
hist(r,0:15:255)