Proyecto Final
Proyecto Final
Proyecto Final
1
a la masa M. Si la masa se desplaza desde su posición de 𝑉𝑜 𝑅
𝑖 ′ (0 ) = − − 𝑖 (0 )
equilibrio y posteriormente se libera en el instante 0, su 𝐿 𝐿
𝑅 ′ 𝑅
movimiento resultante será sobre amortiguado, 𝐿 [ 𝑖 ] = (𝑠𝑖(𝑠) − 𝑖(0))
críticamente amortiguado o subamortiguado (oscilatorio). 𝐿 𝐿
1 1
En la Figura 2 se ha representado el gráfico de los 𝐿 [ 𝑖] = 𝑖 (𝑠 )
𝐿𝐶 𝐿𝐶
movimientos de la masa que resultan tras ser liberada desde 𝑉𝑜
𝑠𝑖 (0) − 𝐿
la posición desplazada 𝑧1 (𝑒𝑛 𝑡 = 0). 𝑖 (𝑠 ) =
𝑅 1
𝑠 2 + 𝐿 𝑠 + 𝐿𝐶
Dependiendo de los valores que tengan los componentes
del circuito vamos a tener 3 diferentes respuestas:
𝑅 1
Sobre amortiguado: 2𝐿 >
√𝐿𝐶
𝑅 1
Amortiguado: 2𝐿 =
√𝐿𝐶
𝑅 1
Sub amortiguado: 2𝐿 <
√𝐿𝐶
2
1 2 1
Amortiguado: (2𝑅𝐶 ) = 𝐿𝐶
1 2 1
Sub amortiguado: (2𝑅𝐶 ) < 𝐿𝐶
Modelo Hidráulico
Modelo de un tanque de nivel
Consideremos el siguiente sistema de control con acción Figura 7. Flujo de una válvula
por válvulas donde le objetivo es mantener constante el fuente: Mecánica de fluidos en ingeniería
nivel a pesar de las variaciones de la demanda.
𝑄𝑣 = 𝐾𝑣 𝐴𝑠 √∆𝑃
𝑄𝑣 = 𝐹𝑙𝑢𝑒𝑗𝑜 𝑎 𝑡𝑟𝑎𝑣𝑒𝑠 𝑑𝑒 𝑣𝑎𝑙𝑣𝑢𝑙𝑎
𝐾𝑣 = 𝑢𝑛𝑎 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡𝑒
𝐾𝑣 = 𝐴𝑟𝑒𝑎 𝑑𝑒 𝑝𝑎𝑠𝑜
𝑄𝑒 = 𝐾1𝑎1
Modelo Robótico
Figura 6. Modelo estático del nivel del tanque El proceso más básico para la Navegación de un robot
fuente: Mecánica de fluidos en ingeniería móvil se basa en el modelo cinemático del sistema de
propulsión. Este sistema es el que permite al robot moverse
dentro de un determinado entorno. Uno de los sistemas más
Si conideramos que la presión manometrica entre los punto usuales se basa en el uso de ruedas de tracción diferencial,
1 y 2 son cero. Que mes la masa de las partículas de fluido el cual es un sistema poco complejo y adecuado para la
entre el punto 1 y 2. Y que v es la velocidad de salida de la navegación en algunos entornos de desarrollo típicos de
partícula 1 y 2 . obtenemos: actividades humanas, por ejemplo, oficinas, bodegas y
1 otros. Las configuraciones de tracción diferencial son muy
𝑚𝑣 2 = 𝑚𝑔𝐻 populares y permiten calcular la posición del robot a partir
2
𝑣 = √2𝑔𝐻 de las ecuaciones geométricas, que surgen de la relación
El flujo de salida del tanque para este caso de una sección entre los componentes del sistema de propulsión y de la
transversal S es: información de los codificadores rotativos que usualmente
llevan acoplados a sus ruedas. Este método de localización
𝑄 = 𝑆𝑣 = 𝑆 √2𝑔𝐻
se conoce como estimación odométrica (Odometric Dead-
De manera general el flujo que pasa por una válvula en
Reckoning). El problema de este método es que por
estado estacionario es dado por:
pequeña que sea la constante de error en el sensor, el error
de localización del robot crecerá sin límites porque éste se
va incrementando a través del tiempo.
3
tienen acoplados dos motores DC, dos ruedas de
estabilización que mantienen el balance del vehículo 𝑋𝑘 = 𝑋𝐾−1 + ∆𝑋𝑘
𝜃(𝑡) = 𝑤(𝑡)
4
Figura 11. Sistema Masa Resorte
fuente: FÍSICA para ciencias e ingeniería
Transformada de Laplace
Se define la transformada de Laplace (L) como:
∞
Figura 10. Determinación de la distancia de las trayectorias L{f(t)} = F(s) = ∫ e−st f(t) dt
fuente: MODELO CINEMÁTICO DE UN ROBOT MÓVIL TIPO 0
DIFERENCIAL Y NAVEGACIÓN Donde (𝑡) es la función original, 𝐹(𝑠) es la transformada, s
es una variable compleja y e−st es llamado el núcleo de la
Modelo Mecánico transformación.
Las propiedades que se utilizarán en este trabajo de
Son aquellos sistemas constituidos fundamentalmente por aplicación serán, considerando el siguiente par de
componentes, dispositivos o elementos que tienen como transformadas de Laplace:
función específica transformar o transmitir el movimiento
desde las fuentes que lo generan, al transformar distintos ℒ [𝑥´] = 𝑠ℒ [𝑥 ] − 𝑥(0)
tipos de energía. Los elementos básicos de todo sistema ℒ [𝑥´´] = 𝑠 2 ℒ [𝑥 ] − 𝑠𝑥(0) − 𝑥´(0)
mecánico son la masa, el resorte y el amortiguador. El Teorema de traslación
estudio del movimiento en sistemas mecánicos se 1 1
corresponde con el análisis de sistemas dinámicos. ℒ −1 [ 2 2
] = 𝑠𝑒𝑛(𝑎𝑡)
𝑠 +𝑎 𝑎
La masa, el resorte, el amortiguador son actuadores −1
1
elementales de un sistema mecánico ℒ [ 2 ] = 𝑐𝑜𝑠(𝑎𝑡)
𝑠 + 𝑎2
La transformada de Laplace provee un método para
Sistema masa-resorte-amortiguador resolver ecuaciones diferenciales lineales con coeficientes
El sistema tiene un elemento resistivo opuesto a un constantes al transformarlas, a través de las propiedades
elemento disipador, uno en un extremo y el otro en el antes descritas, en el problema sencillo de resolver una
extremo opuesto, los extremos unidos por una masa. ecuación algebraica lineal
Al sistema se le aplica una carga externa para desplazarlo Ley de Hooke
desde su posición de equilibrio y posteriormente soltarlo. La ley de Hooke establece que el alargamiento de un
La vibración inicia desde el instante en que desaparece la muelle es directamente proporcional al módulo de la fuerza
fuerza externa y el sistema actúa libremente, por lo que se que se le aplique, siempre y cuando no se deforme
analiza su respuesta bajo la condición sin fuerza externa. permanentemente dicho muelle.
Considerando las condiciones iniciales F = k ⋅ (x − 𝑥 𝑜 )
Donde:
Los sistemas mecánicos de traslación pueden ser usados • F es el módulo de la fuerza que se aplica sobre el
para modelar muchas situaciones e involucran tres muelle.
elementos básicos: masas, resortes y amortiguadores, • k es la constante elástica del muelle, que relaciona
cuyas unidades de medida son, respectivamente, Kg
fuerza y alargamiento. Cuanto mayor es su valor
(kilogramos), N/m (Newton por metro) y Ns/m (Newtons
más trabajo costará estirar el muelle. Depende del
y segundos por metro). El modelo virtual del sistema masa-
resorte-amortiguador tiene factibilidad de realizar cambios muelle, de tal forma que cada uno tendrá la suya
de propiedades de cada elemento tales como: propia.
• 𝑥𝑜 es la longitud del muelle sin aplicar la fuerza.
• Masa (m) • x es la longitud del muelle con la fuerza aplicada.
• Constante del resorte (k)
Segunda ley de Newton
• Constante del amortiguador (h) / (c) La segunda ley de Newton o principio fundamental
• Desplazamiento inicial (𝑥𝑜 ) / q establece que las aceleraciones que experimenta un cuerpo
• Velocidad inicial (𝑣𝑜 ) son proporcionales a las fuerzas que recibe. Probablemente
su forma más célebre es:
F=m⋅a
5
Movimiento sub amortiguado
Los muelles y péndulos que oscilan libremente se detienen
al cabo de un tiempo debido a la pérdida de energía
mecánica disipada por las fuerzas de rozamiento. A este
tipo de movimiento se le denomina amortiguado
Sub amortiguado: donde la fricción es pequeña y el
sistema oscila con amplitudes decrecientes con el tiempo
hasta alcanzar la posición de equilibrio.
6
Figura 16. Aplicación del circuito RLC en paralelo
fuente: Anexo Sistema Eléctrico
Para poder comprobar la ecuación obtenida realizamos la Figura 19. Tanque controlado por la válvula
simulación correspondiente en Multisim como podemos fuente: Mecánica de fluidos en ingeniería
apreciar en la figura 18:
𝐾1 = 0.05 𝑚3 /𝑠
𝐾2 = 0.015 𝑚3 /𝑠
𝑎1 = 0.6
𝑎2 = 0.5
𝐴 = 0.5 𝑚2
𝑚
𝑔 = 10 2
𝑠
𝐻𝑚𝑎𝑥 = 1 𝑚
𝑑ℎ
𝐴 = 𝑄𝑒 − 𝑄𝑠
𝑑𝑡
𝑄𝑒 = 𝐾1 𝑎1
Figura 17. Circuito RLC en paralelo
fuente: Multisim 𝑄𝑠 = 𝐾2 𝑎2 √2𝑔ℎ
𝑑ℎ
𝐴 = 𝐾1 𝑎1 − 𝐾2 𝑎2 √2𝑔ℎ
𝑑𝑡
𝐾1 𝑎1 = 𝐾2 𝑎2 𝐻0
𝐾1 𝑎1
Figura 18. Gráfica del voltaje del circuito en función del 𝐻0 = ( )
tiempo 𝐾2 𝑎2 √2𝑔
fuente: Multisim
𝐻0 = 0.8 𝑚
Modelo Hidráulico
Área de base= 0.5 m^2 (tanque cilíndrico) Tenido en cuenta el punto de equilibrio
Linealizamos por Taylor (tenemos en cuenta que
Hmax. del tanque 1 m a2 es una constante)
K1=0.05 m3/s
K2=0.015 m3/s 𝑑ℎ
A10=0.6(abertura de equilibrio de a1) 𝑓 (𝑎1 , ℎ) = 𝐴
𝑑𝑡
A20=0.5 (abertura de equilibrio de a2)
G= 10 m/s2
𝜕𝑓 1
𝑓 (𝑎1 , ℎ) ≈ 𝑓(𝑎 ̅
1 ℎ) +
̅̅̅, ∆𝑎1 |(𝑎
𝜕𝑎1 ̅̅̅, ̅
1 ℎ)
• Tanque controlado por la válvula de entrada,
𝜕𝑓 1
considerando a2 como perturbación + ∆ℎ |(𝑎
𝜕ℎ ̅̅̅, ̅
1 ℎ)
• Tanque controlado por la válvula de salida,
considerando al como perturbación
∆𝑎1 = 𝑎1 − ̅̅̅
𝑎1
∆ℎ = ℎ1 − ℎ̅
7
𝑑ℎ 1
𝑑ℎ 𝑓 (𝑎2 , ℎ ) ≈ 𝐴 | ̅̅̅, ℎ̅) − 𝐾2 √2𝑔ℎ̅∆𝑎2
𝑑𝑡 (𝑎 2
𝐴 = 𝐾1 𝑎1 − 𝐾2 𝑎2 √2𝑔ℎ
𝑑𝑡 𝐾2 ̅̅̅
𝑎2 √2𝑔
− ∆ℎ
2√ℎ̅
𝑎1 2 𝑎2 √2𝑔ℎ̅ + 𝐾1 ∆𝑎1
𝑓(𝑎1 , ℎ) ≈ 𝐾1̅̅̅−𝐾
𝐾2 𝑎2 √2𝑔ℎ
− ∆ℎ 𝑑∆ℎ 𝐾2 𝑎2 √2𝑔
2√ℎ̅ 𝐴 ≈ −𝐾2 √2𝑔ℎ̅∆𝑎2 − ∆ℎ
𝑑𝑡 2√ℎ̅
𝑑ℎ 1
𝑓(𝑎1 , ℎ) ≈ 𝐴 |(𝑎 ̅ + 𝐾1 ∆𝑎1 𝐾2 𝑎2 √2𝑔
𝑑𝑡 1 ℎ)
̅̅̅,
𝐴𝑠ℎ(𝑠) = −𝐾2 √2𝑔ℎ̅𝑎2 (𝑠) − ∆ℎ
𝐾2 𝑎2 √2𝑔ℎ 2√ℎ̅
− ∆ℎ
2√ℎ̅
ℎ (𝑠 ) 𝐾2 𝑎2 √2𝑔
=−
𝑑ℎ 𝑑ℎ 1 𝐾2 𝑎2 √2𝑔ℎ 𝑎2 ( 𝑠 ) 𝐾2 ̅̅̅
𝑎2 √2𝑔
𝐴 ≈𝐴 | ̅̅̅, ℎ̅) + 𝐾1 ∆𝑎1 − ∆ℎ 𝐴𝑠 +
𝑑𝑡 𝑑𝑡 (𝑎 1 2√ℎ̅ 2√ℎ̅
ℎ (𝑠 ) 𝐾1
=
𝑎1 (𝑠) 𝐾2 𝑎2 √2𝑔
𝐴𝑠 +
2√ℎ̅
ℎ (𝑠 ) 0.1
=
𝑎1 (𝑠) 𝑠 + 0.0375
𝑑ℎ
𝐴 = 𝐾1 𝑎1 − 𝐾2 𝑎2 √2𝑔ℎ
𝑑𝑡
8
El tanque tiene un comportamiento no lineal donde si se va
variando la entrada a1 donde a2 es constante donde le nivel
se empieza a comportar de una manera creciente.
Modelo Robótico.
Tiempo de simulación: 70s
Figura 21. Sistema tanque controlado por válvula Paso del tiempo: 0.1
fuente: Simulink Condiciones iniciales
x (0) =0
y (0) =0
Orientación inicial=0
Referencias deseadas
9
𝑥´´ + 6𝑥´ + 25𝑥 = 0
Transformada de Laplace
Nota
ℒ [𝑥´] = 𝑠ℒ [𝑥 ] − 𝑥(0)
ℒ 𝑥´´ = 𝑠 2 ℒ [𝑥 ] − 𝑠𝑥(0) − 𝑥´(0)
[ ]
ℒ [𝑥´] = 𝑠ℒ [𝑥] − (−1)
ℒ [𝑥´´] = 𝑠 2 ℒ [𝑥] − 𝑠(−1) − (2)
Figura 27. Trayectorias en función del tiempo
fuente: Anexo sistema robótico
𝑠 2 ℒ [𝑥] + 𝑠 − 2 + 6(𝑠ℒ[𝑥 ] + 1) + 25ℒ[𝑥 ] = 0
(𝑠 2 + 6𝑠 + 25)ℒ[𝑥 ] = −𝑠 + 2 − 6
Modelo Mecánico −𝑠 − 4
ℒ [𝑥 ] = 2
(𝑠 + 6𝑠 + 25)
Sistema MASA RESORTE AMORTIGUADOR −𝑠 − 4
𝑥 = ℒ −1 2
(𝑠 + 6𝑠 + 25)
−1
−𝑠 − 4
𝑥=ℒ [ ]
(𝑠 + 3)2 + 16
Por el Teorema de Traslación
−𝑠 − 1
𝑥 = 𝑒 −3𝑡 ℒ −1 [ 2 ]
𝑠 + 16
𝑠+1
𝑥 = −𝑒 −3𝑡 ℒ −1 [ 2 ]
𝑠 + 42
𝑠 1
𝑥 = −𝑒 −3𝑡 ℒ −1 2 −𝑒 −3𝑡 ℒ −1 2
𝑠 + 42 𝑠 + 42
Nota
Figura 28. Sistema masa resorte amortiguador 1 1
ℒ −1 [ ] = 𝑠𝑒𝑛(𝑎𝑡)
fuente: Physics +𝑎 𝑠2
2 𝑎
−1
1
m: masa del objeto ℒ [ 2 ] = 𝑐𝑜𝑠(𝑎𝑡)
𝑠 + 𝑎2
x: posición del objeto
k: constante del resorte 1
h: constante del amortiguador 𝑥 = − 𝑒 −3𝑡 sen(4𝑡) −𝑒 −3𝑡 cos(4𝑡)
4
𝐹𝐴: Fuerza del amortiguador
x´ = derivada de posición respecto al tiempo 1
𝑥 = −𝑒 −3𝑡 ( sen(4𝑡) + cos(4𝑡))
4
Se conecta un objeto de 2kg con posición inicial de -1m, a Cuando la ecuación de una exponencial negativa por la
un resorte cuya constante k = 50, a una pared, y del otro combinación de un seno y coseno se denomina un
lado se coloca un amortiguador de constante h = 12, movimiento sub amortiguado
mediante transformadas de Laplace determine la ecuación
que caracteriza la posición del objeto en función del
tiempo. Además de su gráfica
𝐹𝐴 = −ℎ𝑣 = −ℎ𝑥´
10
IV. CONCLUSIONES
• Del trabajo realizado se concluye que la distancia
recorrida por el robot móvil tiene un margen de
error muy pequeño.
• Se mostró la implementación de un sistema de
medida de distancia recorrida utilizando la
información sensorial obtenida de un sistema de
odometría.
• Es posible observar, que la utilización de la
transformada de Laplace facilita notablemente la
resolución de ecuaciones diferenciales de
cualquier orden, posibilitando un análisis rápido y
certero de cualquier sistema físico que se presente
en el estudio de diversas ramas de la Ingeniería.
V. REFERENCIAS
11
[varargout{1:nargout}] = gui_mainfcn(gui_State,
ANEXOS varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
SISTEMA ELCTRICO end
% End initialization code - DO NOT EDIT
function varargout = untitled(varargin) % --- Executes just before untitled is made visible.
% UNTITLED MATLAB code for untitled.fig function untitled_OpeningFcn(hObject, eventdata,
% UNTITLED, by itself, creates a new UNTITLED or handles, varargin)
raises the existing axes(handles.axes1);
% singleton*. [x,map]=imread('RLC en serie.jpg');
% image(x)
% H = UNTITLED returns the handle to a new colormap(map);
UNTITLED or the handle to axis off
% the existing singleton*. hold on
%
% axes(handles.axes2);
UNTITLED('CALLBACK',hObject,eventData,handles,... [x,map]=imread('RLC en paralelo.jpg');
) calls the local image(x)
% function named CALLBACK in UNTITLED.M with colormap(map);
the given input arguments. axis off
% hold on
% UNTITLED('Property','Value',...) creates a new % This function has no output args, see OutputFcn.
UNTITLED or raises the % hObject handle to figure
% existing singleton*. Starting from the left, property % eventdata reserved - to be defined in a future version of
value pairs are MATLAB
% applied to the GUI before untitled_OpeningFcn gets % handles structure with handles and user data (see
called. An GUIDATA)
% unrecognized property name or invalid value makes % varargin command line arguments to untitled (see
property application VARARGIN)
% stop. All inputs are passed to untitled_OpeningFcn
via varargin. % Choose default command line output for untitled
% handles.output = hObject;
% *See GUI Options on GUIDE's Tools menu. Choose
"GUI allows only one % Update handles structure
% instance to run (singleton)". guidata(hObject, handles);
%
% See also: GUIDE, GUIDATA, GUIHANDLES % UIWAIT makes untitled wait for user response (see
UIRESUME)
% Edit the above text to modify the response to help % uiwait(handles.figure1);
untitled
% Last Modified by GUIDE v2.5 28-Jul-2020 01:05:13 % --- Outputs from this function are returned to the
command line.
% Begin initialization code - DO NOT EDIT function varargout = untitled_OutputFcn(hObject,
gui_Singleton = 1; eventdata, handles)
gui_State = struct('gui_Name', mfilename, ... % varargout cell array for returning output args (see
'gui_Singleton', gui_Singleton, ... VARARGOUT);
'gui_OpeningFcn', @untitled_OpeningFcn, ... % hObject handle to figure
'gui_OutputFcn', @untitled_OutputFcn, ... % eventdata reserved - to be defined in a future version of
'gui_LayoutFcn', [] , ... MATLAB
'gui_Callback', []); % handles structure with handles and user data (see
if nargin && ischar(varargin{1}) GUIDATA)
gui_State.gui_Callback = str2func(varargin{1});
end % Get default command line output from handles structure
varargout{1} = handles.output;
if nargout
12
% --- Executes on button press in radiobutton1. % eventdata reserved - to be defined in a future version of
function radiobutton1_Callback(hObject, eventdata, MATLAB
handles) % handles structure with handles and user data (see
% hObject handle to radiobutton1 (see GCBO) GUIDATA)
% eventdata reserved - to be defined in a future version of
MATLAB % Hints: get(hObject,'String') returns contents of L1 as text
% handles structure with handles and user data (see % str2double(get(hObject,'String')) returns contents of
GUIDATA) L1 as a double
13
function Vo1_Callback(hObject, eventdata, handles) end
% hObject handle to Vo1 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB
% handles structure with handles and user data (see function R2_Callback(hObject, eventdata, handles)
GUIDATA) % hObject handle to R2 (see GCBO)
% eventdata reserved - to be defined in a future version of
% Hints: get(hObject,'String') returns contents of Vo1 as MATLAB
text % handles structure with handles and user data (see
% str2double(get(hObject,'String')) returns contents of GUIDATA)
Vo1 as a double
% Hints: get(hObject,'String') returns contents of R2 as text
% str2double(get(hObject,'String')) returns contents of
% --- Executes during object creation, after setting all R2 as a double
properties.
function Vo1_CreateFcn(hObject, eventdata, handles)
% hObject handle to Vo1 (see GCBO) % --- Executes during object creation, after setting all
% eventdata reserved - to be defined in a future version of properties.
MATLAB function R2_CreateFcn(hObject, eventdata, handles)
% handles empty - handles not created until after all % hObject handle to R2 (see GCBO)
CreateFcns called % eventdata reserved - to be defined in a future version of
MATLAB
% Hint: edit controls usually have a white background on % handles empty - handles not created until after all
Windows. CreateFcns called
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), % Hint: edit controls usually have a white background on
get(0,'defaultUicontrolBackgroundColor')) Windows.
set(hObject,'BackgroundColor','white'); % See ISPC and COMPUTER.
end if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Io1_Callback(hObject, eventdata, handles)
% hObject handle to Io1 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB function L2_Callback(hObject, eventdata, handles)
% handles structure with handles and user data (see % hObject handle to L2 (see GCBO)
GUIDATA) % eventdata reserved - to be defined in a future version of
MATLAB
% Hints: get(hObject,'String') returns contents of Io1 as % handles structure with handles and user data (see
text GUIDATA)
% str2double(get(hObject,'String')) returns contents of
Io1 as a double % Hints: get(hObject,'String') returns contents of L2 as text
% str2double(get(hObject,'String')) returns contents of
L2 as a double
% --- Executes during object creation, after setting all
properties.
function Io1_CreateFcn(hObject, eventdata, handles) % --- Executes during object creation, after setting all
% hObject handle to Io1 (see GCBO) properties.
% eventdata reserved - to be defined in a future version of function L2_CreateFcn(hObject, eventdata, handles)
MATLAB % hObject handle to L2 (see GCBO)
% handles empty - handles not created until after all % eventdata reserved - to be defined in a future version of
CreateFcns called MATLAB
% handles empty - handles not created until after all
% Hint: edit controls usually have a white background on CreateFcns called
Windows.
% See ISPC and COMPUTER. % Hint: edit controls usually have a white background on
if ispc && isequal(get(hObject,'BackgroundColor'), Windows.
get(0,'defaultUicontrolBackgroundColor')) % See ISPC and COMPUTER.
set(hObject,'BackgroundColor','white');
14
if ispc && isequal(get(hObject,'BackgroundColor'), % Hint: edit controls usually have a white background on
get(0,'defaultUicontrolBackgroundColor')) Windows.
set(hObject,'BackgroundColor','white'); % See ISPC and COMPUTER.
end if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function C2_Callback(hObject, eventdata, handles)
% hObject handle to C2 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB function Io2_Callback(hObject, eventdata, handles)
% handles structure with handles and user data (see % hObject handle to Io2 (see GCBO)
GUIDATA) % eventdata reserved - to be defined in a future version of
MATLAB
% Hints: get(hObject,'String') returns contents of C2 as text % handles structure with handles and user data (see
% str2double(get(hObject,'String')) returns contents of GUIDATA)
C2 as a double
% Hints: get(hObject,'String') returns contents of Io2 as
text
% --- Executes during object creation, after setting all % str2double(get(hObject,'String')) returns contents of
properties. Io2 as a double
function C2_CreateFcn(hObject, eventdata, handles)
% hObject handle to C2 (see GCBO)
% eventdata reserved - to be defined in a future version of % --- Executes during object creation, after setting all
MATLAB properties.
% handles empty - handles not created until after all function Io2_CreateFcn(hObject, eventdata, handles)
CreateFcns called % hObject handle to Io2 (see GCBO)
% eventdata reserved - to be defined in a future version of
% Hint: edit controls usually have a white background on MATLAB
Windows. % handles empty - handles not created until after all
% See ISPC and COMPUTER. CreateFcns called
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor')) % Hint: edit controls usually have a white background on
set(hObject,'BackgroundColor','white'); Windows.
end % See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
function Vo2_Callback(hObject, eventdata, handles) end
% hObject handle to Vo2 (see GCBO)
% eventdata reserved - to be defined in a future version of
MATLAB % --- Executes on button press in pushbutton1.
% handles structure with handles and user data (see function pushbutton1_Callback(hObject, eventdata,
GUIDATA) handles)
% hObject handle to pushbutton1 (see GCBO)
% Hints: get(hObject,'String') returns contents of Vo2 as % eventdata reserved - to be defined in a future version of
text MATLAB
% str2double(get(hObject,'String')) returns contents of % handles structure with handles and user data (see
Vo2 as a double GUIDATA)
clc;
a=str2num(get(handles.R1,'string'));
% --- Executes during object creation, after setting all b=str2num(get(handles.L1,'string'));
properties. c=str2num(get(handles.C1,'string'));
function Vo2_CreateFcn(hObject, eventdata, handles) d=str2num(get(handles.Vo1,'string'));
% hObject handle to Vo2 (see GCBO) e=str2num(get(handles.Io1,'string'));
% eventdata reserved - to be defined in a future version of
MATLAB a1=a/b;
% handles empty - handles not created until after all a2=1/(b*c);
CreateFcns called
set(handles.RL,'string',a1);
15
set(handles.LC,'string',a2); b1='Subamortiguado';
a3=(a1/2)*(-1);
if (a1^2<(4)*(a2)) a4=(sqrt(((a1^2)-4*(a2))*(-1))/2);
b1='Subamortiguado'; a5=(-(e/c)-d/(a*c));
a3=(a1/2)*(-1); a6=((a5-(a3*d))/a4);
a4=(sqrt(((a1^2)-4*(a2))*(-1))/2); set(handles.e5,'string',a3);
a5=(-(d/b)-a1*e); set(handles.ima12,'string',a4);
a6=((a5-(a3*e))/a4); set(handles.const112,'string',d);
set(handles.e1,'string',a3); set(handles.const212,'string',a6);
set(handles.ima1,'string',a4); set(handles.tip2,'string',b1);
set(handles.const11,'string',e); elseif (a1^2>(4)*(a2))
set(handles.const21,'string',a6); b1='Sobreamortiguado';
set(handles.tip,'string',b1); a3=((-a1+sqrt((a1^2)-4*(a2)))/2);
elseif (a1^2>(4)*(a2)) a4=((-a1-sqrt((a1^2)-4*(a2)))/2);
b1='Sobreamortiguado'; a5=(-(e/c)-d/(a*c));
a3=((-a1+sqrt((a1^2)-4*(a2)))/2); a6=[1 1;a3 a4];
a4=((-a1-sqrt((a1^2)-4*(a2)))/2); a7=[d;a5];
a5=(-(d/b)-(a1*e)); a8=inv(a6);
a6=[1 1;a3 a4]; a9=a8*a7;
a7=[e;a5]; set(handles.e6,'string',a3);
a8=inv(a6); set(handles.e7,'string',a4);
a9=a8*a7; set(handles.const122,'string',a9(1,1));
set(handles.e2,'string',a3); set(handles.const222,'string',a9(2,1));
set(handles.e3,'string',a4); set(handles.tip2,'string',b1);
set(handles.const12,'string',a9(1,1)); elseif (a1^2==(4)*(a2))
set(handles.const22,'string',a9(2,1)); b1='Amortiguado';
set(handles.tip,'string',b1); a3=((-a1+sqrt((a1^2)-4*(a2)))/2);
elseif (a1^2==(4)*(a2)) a4=(-(e/c)-d/(a*c));
b1='Amortiguado'; a5=(a4-(a3*(d)));
a3=((-a1+sqrt((a1^2)-4*(a2)))/2); set(handles.e8,'string',a3);
a4=(-(d/b)-a1*e); set(handles.const232,'string',d);
a5=(a4-(a3*(e))); set(handles.const132,'string',a5);
set(handles.e4,'string',a3); set(handles.tip2,'string',b1);
set(handles.const23,'string',e); end
set(handles.const13,'string',a5);
set(handles.tip,'string',b1);
end
16
% Punto de Equilibrio de Tanque SISTEMA ROBÓTICO
Ho=(k1^2*A1o^2)/(k2^2*A2o^2*2*g);
%robot móvil
17
%11 Modelo Cinemático
xp(k) =u_ref(k)*cos(psi(k))-a*w_ref(k)*sin(psi(k)); subplot(3,1,3)
yp(k) =u_ref(k)*sin(psi(k))+a*w_ref(k)*cos(psi(k)); plot(t,psi(1:length(t)),'m'); grid;
title('Rotación');
xlabel('Tiempo[s]'); ylabel('\psi')
psi(k+1) = To*w_ref(k)+psi(k); figure
%animacion
scrsz=get(0,'ScreenSize');
off1=0;
off2=100;
figpos=[off1 off2 scrsz(3)-off1 scrsz(4)-off2];
f1=figure(1);
set(f1,'Color','w','Position',figpos);
Robot_Dimension(2);
Ho=Robot_Plot_3D(x(1),y(1),psi(1),'g'); hold on
H4 = plot(Pxd(1),Pyd(1),'b');
for i=1:paso:length(t)
delete(Ho)
delete(H1)
delete(H2)
delete(H4)
axis([-3 5 -3 5 0 1]);
view([-30.0,30.0]);
Ho=Robot_Plot_3D(x(i),y(i),psi(i),'g');hold on
H1 = plot(x(i),y(i),'*m');hold on
H2 = plot(x(1:i),y(1:i),'g');hold on
H3 = plot(Pxd,Pyd,'m');hold on
H4 = plot(Pxd(i),Pyd(i),'*b');
grid on;
pause(To)
end
%Gráficas
figure
subplot(3,1,1)
plot(t,x(1:length(t))); grid;
title('Desplazamiento en X');
xlabel('Tiempo[s]'); ylabel('X[m]');
subplot(3,1,2)
plot(t,y(1:length(t)),'g'); grid;
title('Desplazamiento en Y');
xlabel('Tiempo[s]'); ylabel('Y[m]');
18