Está en la página 1de 8

EXAMEN FINAL RECUPERACIN DE LABORATORIO DE

CONTROL 2
Implemento una seal de tren de pulsos para mi planta y obtengo a siguiente grfica:

FUNCIN REAL:
SALIDA DE LA NUEVA FUNCIN MODELO

HALLAMOS VALORES ALEATORIOS DE K, A,y B DE LA FUNCION DE TRANSFERENCIA REAL


PARA ACERCARNOS A UN MINIMO ERROR DE LOS VALORES BAJO CIERTAS RESTRICCIONES
PARA CADA VALOR .

VALORES ALEATORIOS
clear all
clc
format bank
%parametros de la funcion de transferencia
%elige valores aleatorios para los diferentes valores de
Kvector=1+(20-1).*rand(100,1)
avector=0.01+(2-0.01).*rand(500,1)
bvector=0.1+(10-0.1).*rand(500,1)
%%%RESTRICCIONES
% valores escogidos al azar en base a restricciones
%valor de K=10
for i=1:length(Kvector)
k=Kvector(i,1);
if (k >= 9.8) && (k <= 10.2)
K=k;
end
end
K
%valor de A=0.5
for j=1:length(avector)
d=avector(j,1);
if (d >= 0.48) && (d <= 0.52)
A=d;
end
end
A
%valor de B=2
for n=1:length(bvector)
b=bvector(n,1);
if (b >= 1.95) && (b <= 2.1)
B=b;
end
end
B

LOS VALORES OPTIMOS SON

ESTOS VALORES SON A LOS QUE LA FUNCIN SE DEBER ACERCAR PARA OBTENER UN
SISTEMA PTIMO CON VALORES ALEATORIOS VALORES ESCOGIDOS AL AZAR CON LA FUNCIN
RAND

K=10;

A=0.5;

B=2;

DE LOS VALORES OBTENIDOS ALEATORIAMENTE

ITERACIN K A B
1 3.99 0.03 8.20
2 12.88 1.20 9.39
3 14.28 1.22 0.10
4 2.63 1.84 6.44
5 11.09 1.47 0.17
6 17.88 0.61 1.15
7 6.01 1.00 1.16
8 5.46 0.52 3.73
9 16.95 1.47 2.47
10 10.42 0.24 3.53
11 3.89 1.49 2.57
12 5.38 1.62 3.93
13 13.50 1.49 4.27
14 11.70 0.68 6.44
15 6.54 1.17 7.90
16 12.82 0.94 2.77
17 14.60 0.18 8.46
18 6.33 1.66 7.43
19 8.83 1.38 8.28
20 7.88 0.54 1.90
21 15.85 1.94 0.75
22 3.57 0.38 6.14
23 18.14 0.61 7.05
24 6.50 0.83 1.21
25 10.49 0.48 1.05
26 15.89 0.40 6.02
27 13.86 1.41 8.14
28 3.85 0.37 8.16
29 14.24 1.05 0.99
30 3.45 0.60 7.34
31 18.97 0.93 9.05
32 17.84 1.85 4.58
33 10.79 0.44 0.80
34 13.91 0.01 2.49
35 19.56 1.81 7.35
36 3.38 1.36 0.50
37 15.29 1.03 4.30
38 16.71 1.05 5.45
39 15.85 0.21 9.54
40 4.63 1.99 2.17
41 9.14 0.72 1.25
42 1.27 1.25 6.50
43 7.18 0.79 1.17
44 3.56 0.03 9.84
45 9.56 1.10 2.56
46 11.87 1.02 6.10
47 16.05 0.50 8.19
48 8.97 0.10 8.32
49 11.12 1.69 4.94
50 18.59 0.11 7.63
51 18.08 0.64 9.16
52 11.35 1.57 9.02
53 18.12 1.95 2.22
54 1.98 1.18 5.52
55 16.36 1.56 7.87
56 7.36 1.46 2.02
57 5.34 1.31 7.49
58 16.63 1.33 4.81
59 7.62 1.88 5.87
60 4.14 1.07 2.68
61 1.53 0.80 0.94
62 19.15 1.34 3.05
63 13.93 0.89 9.18
64 17.35 0.27 4.76
65 18.84 0.88 2.77
66 13.92 1.10 7.65
67 18.43 0.80 7.74
68 5.88 0.80 0.31
69 17.83 1.51 8.81
70 18.48 1.05 8.00
71 6.70 0.99 3.31
72 2.39 0.19 6.72
73 15.58 0.51 3.03
74 2.61 0.90 9.31
75 14.85 1.28 2.89
76 9.51 1.42 1.77
77 13.37 1.99 7.48
78 4.22 1.87 4.82
79 11.10 0.19 6.57
80 13.04 1.91 9.67
81 1.27 0.33 3.20
82 9.94 1.94 0.86
83 17.84 1.20 7.94
84 3.17 0.49 3.72
85 9.41 0.15 5.89
86 13.53 0.61 1.92
87 6.60 1.63 0.86
88 19.06 0.16 1.62
89 14.19 0.72 8.29
90 4.93 0.27 3.08
91 11.54 0.32 3.90
92 17.71 0.13 6.54
93 11.60 1.41 8.19
94 15.29 0.18 7.69
95 18.00 1.24 3.80
96 17.00 0.36 1.98
97 3.49 1.31 6.50
98 4.59 1.00 0.14
99 3.92 0.58 2.90
100 1.55 1.66 6.42

VALORES OPTIMOS ESCOGIDOS ALEATORIAMENTE

K=

9.98

A=

0.48

B=

2.08
ERROR PORCENTUAL

ERROR =

0.09

GRAFICANDO LAS SALIDAS PARA W DE LA FUNCION DE TRANSFERENCIA MODELO


CON Y QUE ES LA FUNCION DE TRANSFERENCIA REAL

FUNCION OBJETIVO

FUNCIN PTIMA
clear all
clc
format bank
%parametros de la funcion de transferencia
%elige valores aleatorios para los diferentes valores de
Kvector=1+(20-1).*rand(100,1)
avector=0.01+(2-0.01).*rand(100,1)
bvector=0.1+(10-0.1).*rand(100,1)
%%%RESTRICCIONES
% valores escogidos al azar en base a restricciones
%valor de K=10
for i=1:length(Kvector)
k=Kvector(i,1);
if (k >= 9.8) && (k <= 10.2)
K=k;
end
end
K
%valor de A=0.5
for j=1:length(avector)
d=avector(j,1);
if (d >= 0.48) && (d <= 0.52)
A=d;
end
end
A
%valor de B=2
for n=1:length(bvector)
b=bvector(n,1);
if (b >= 1.95) && (b <= 2.1)
B=b;
end
end
B
sim('untitled')
error=abs((Y(:,2)- W(:,2))./Y(:,2))*100;
disp('ERROR PORCENTUAL')
ERROR=min(error)

t=W(:,1);
hold on
plot(t,W(:,2),'r');plot(t,Y(:,2))
grid on
hold off

También podría gustarte