Você está na página 1de 16

1


MARIA CAICEDO CHAMORRO
DAVID REYES LOPEZ

TRABAJO PROGRAMACION No.2


RESUMEN
𝑣∗𝑑
En este trabajo se quiere desarrollar a través del software Matlab un
𝑅𝑒 = 𝑣𝑖𝑠𝑐𝑜𝑠𝑖𝑑𝑎𝑑 →EC12
programa para realizar un pre diseño de los sistemas de trasporte de
agua y generación de energía a los caseríos y para cualquier par de
localidades con localizaciones geográficas similares.
𝑃 = ℽ ∗ ℎ →EC13
PALABRAS CLAVE
𝑃𝐻𝑖𝑑𝑟𝑎𝑢𝑙𝑖𝑐𝑎 = ℎ𝑏 += ℽ + 𝑄 →EC14
fluido, interfaz, Matlab, potencia en la turbina y en el
generador, potencias requeridas para el bombeo, perdidas en las
𝑃𝑚𝑒𝑐𝑎𝑛𝑖𝑐𝑎 = 𝑃𝑒𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑎 ∗ 𝜂𝑚𝑜𝑡𝑜𝑟 →EC15
tuberías, distancias, alturas, caudal,
𝑃𝑚𝑒𝑐𝑎𝑛𝑖𝑐𝑎
𝜂𝑏𝑜𝑚𝑏𝑎 = →EC16
𝑃𝑒𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑎
I. PROCEDIMIENTO,ANALISIS Y RESULTADOS
A partir de los datos ingresados en el programa, se utilizaron 𝑃𝑚𝑒𝑐𝑎𝑛𝑖𝑐𝑎
las siguientes fórmulas para obtener los datos de salida : 𝜂𝑚𝑜𝑡𝑜𝑟 = →EC17
𝑃𝑒𝑙𝑒𝑐𝑡𝑟𝑖𝑐𝑎

𝑣12 𝑝1 𝑣22 𝑝2
+ ℎ1 + = + ℎ2 + →EC1 𝑣12 𝑣22 𝑝2
2𝑔 ℽ 2𝑔 ℽ + ℎ1 − ℎ𝑝 + ℎ𝑏 = 2𝑔 + ℎ2 + ℽ →EC18
2𝑔
𝑟
1 𝑑 2,51
= −2 log ( + ) 𝑅𝑒 < 1𝑥105
𝑉 √𝑓 3,7 𝑅𝑒 √𝑓
= 𝑄 →EC2
𝑡

𝑟 1,11
𝑄 = 𝑣 ∗ 𝐴 →EC3 1 6,9
= −1,8 log ( + 𝑑 ) 𝑅𝑒 > 1𝑥105
√𝑓 𝑅𝑒 3,7
𝜋
𝐴 = 4 𝐷2 →EC4

𝑘−𝑘1 𝑘 −𝑘
= 𝑑1−𝑑2 →EC5 CALCULOS DE TOQUILLA
𝑑−𝑑1 1 2 𝑄11 = 𝑄1 ∗ 0.001
1000
𝑃𝑀1 = 𝑃𝐸1 ∗
ℎ𝑝 = ℎ𝑝1 + ℎ𝑝2 →EC6 𝑛𝐺
𝑃𝑀1
𝑃𝑇 =
𝑣2
𝑛𝑇
ℎ𝑝1 = Σ𝑘 ∗ 2𝑔 →EC7 𝑃𝑇
𝐻𝑇 =
(𝑄11 ∗ 9810)
28
𝑙 𝑣2 𝐻𝑃1 = 𝐻𝑇 ∗
ℎ𝑝2 = f ∗ 𝑑 ∗ 2𝑔 →EC8 100

𝑄112
𝑑1 = √√ ∗ 10
Σ𝑘 = 𝐾 + 𝑃𝑒𝑟𝑑𝑖𝑑𝑎𝑠 →EC9 ((12.1026024) ∗ (𝐻𝑇 + 𝐻𝑃1 − 𝐻1))

𝑄𝑒𝑛𝑡𝑟𝑎𝑑𝑎 = 𝑄𝑠𝑎𝑙𝑖𝑑𝑎 →EC1O 𝐷1 𝐷3 𝐷22


𝐿1 = + +√ + 𝐻12
1000 1000 10002
𝑚
= 𝑉 →EC11
𝜌
CALCULOS CUITIVA
2

% Edit the above text to modify the


response to help portada
𝑄22 = 𝑄2 ∗ 0.001
𝑃𝑀2 = 𝑃𝐸2 ∗ 1000 ∗ 𝑛𝑀 % Last Modified by GUIDE v2.5 22-Sep-2019
𝑃𝐵 = 𝑃𝑀2 ∗ 𝑛𝐵 19:10:30
𝑃𝐵
𝐻𝐵 = % Begin initialization code - DO NOT EDIT
(9810 ∗ 𝑄22)
𝐷4 gui_Singleton = 1;
𝐿2 = + 𝐻2 gui_State = struct('gui_Name',
1000
28 mfilename, ...
𝐻𝑃2 = 𝐻𝐵 ∗ 'gui_Singleton',
100
gui_Singleton, ...
𝑄222 'gui_OpeningFcn',
𝑑2 = √√ ∗ 10 @portada_OpeningFcn, ...
((12.1026024) ∗ (𝐻2 − 𝐻𝐵 + 𝐻𝑃2))
'gui_OutputFcn',
@portada_OutputFcn, ...
'gui_LayoutFcn', [] ,
...
'gui_Callback', []);
El programa esta dividido en 3 interfaces las cuales son: if nargin && ischar(varargin{1})
gui_State.gui_Callback =
PRESENTACION: En esta parte del programa str2func(varargin{1});
se muestra un recuadro con el título del trabajo end
para ello utilizamos el siguiente código:
if nargout
function varargout = [varargout{1:nargout}] =
portada(varargin) gui_mainfcn(gui_State, varargin{:});
% PORTADA MATLAB code for portada.fig else
% PORTADA, by itself, creates a new gui_mainfcn(gui_State, varargin{:});
PORTADA or raises the existing end
% singleton*. % End initialization code - DO NOT EDIT
%
% H = PORTADA returns the handle to
a new PORTADA or the handle to
% --- Executes just before portada is
% the existing singleton*.
made visible.
%
function portada_OpeningFcn(hObject,
%
eventdata, handles, varargin)
PORTADA('CALLBACK',hObject,eventData,hand
% This function has no output args, see
les,...) calls the local
OutputFcn.
% function named CALLBACK in
% hObject handle to figure
PORTADA.M with the given input arguments.
% eventdata reserved - to be defined in
%
a future version of MATLAB
% PORTADA('Property','Value',...)
% handles structure with handles and
creates a new PORTADA or raises the
user data (see GUIDATA)
% existing singleton*. Starting
% varargin command line arguments to
from the left, property value pairs are
portada (see VARARGIN)
% applied to the GUI before
portada_OpeningFcn gets called. An
% unrecognized property name or % Choose default command line output for
invalid value makes property application portada
% stop. All inputs are passed to handles.output = hObject;
portada_OpeningFcn via varargin.
% % Update handles structure
% *See GUI Options on GUIDE's Tools guidata(hObject, handles);
menu. Choose "GUI allows only one
% instance to run (singleton)". % UIWAIT makes portada wait for user
% response (see UIRESUME)
% See also: GUIDE, GUIDATA, GUIHANDLES % uiwait(handles.figure1);
3

% --- Outputs from this function are % INGRESAR_DATOS MATLAB code for
returned to the command line. ingresar_datos.fig
function varargout = % INGRESAR_DATOS, by itself, creates
portada_OutputFcn(hObject, eventdata, a new INGRESAR_DATOS or raises the
handles) existing
% varargout cell array for returning % singleton*.
output args (see VARARGOUT); %
% hObject handle to figure % H = INGRESAR_DATOS returns the
% eventdata reserved - to be defined in handle to a new INGRESAR_DATOS or the
a future version of MATLAB handle to
% handles structure with handles and % the existing singleton*.
user data (see GUIDATA) %
%
% Get default command line output from INGRESAR_DATOS('CALLBACK',hObject,eventDa
handles structure ta,handles,...) calls the local
varargout{1} = handles.output; % function named CALLBACK in
INGRESAR_DATOS.M with the given input
arguments.
%
% --- Executes on button press in %
togglebutton1. INGRESAR_DATOS('Property','Value',...)
function togglebutton1_Callback(hObject, creates a new INGRESAR_DATOS or raises
eventdata, handles) the
% hObject handle to togglebutton1 (see % existing singleton*. Starting
GCBO) from the left, property value pairs are
% eventdata reserved - to be defined in % applied to the GUI before
a future version of MATLAB ingresar_datos_OpeningFcn gets called.
% handles structure with handles and An
user data (see GUIDATA) % unrecognized property name or
close(portada); invalid value makes property application
ingresar_datos; % stop. All inputs are passed to
% Hint: get(hObject,'Value') returns ingresar_datos_OpeningFcn via varargin.
toggle state of togglebutton1 %
% *See GUI Options on GUIDE's Tools
De este código resulta la siguiente interfaz: menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the


response to help ingresar_datos

% Last Modified by GUIDE v2.5 25-Sep-2019


22:28:19

% Begin initialization code - DO NOT EDIT


gui_Singleton = 1;
gui_State = struct('gui_Name',
mfilename, ...
'gui_Singleton',
gui_Singleton, ...
Imagen 1. 'gui_OpeningFcn',
@ingresar_datos_OpeningFcn, ...
INGRESO DE DATOS:En esta parte del programa se 'gui_OutputFcn',
mostrara un recuadro , donde se podra ingresar cada uno de los @ingresar_datos_OutputFcn, ...
valores que se necesitan para dicho ejercicio y para ello se 'gui_LayoutFcn', [] ,
utilizo el siguiente codigo: ...
'gui_Callback', []);
function varargout = if nargin && ischar(varargin{1})
ingresar_datos(varargin)
4

gui_State.gui_Callback =
str2func(varargin{1}); function edit1_Callback(hObject,
end eventdata, handles)
% hObject handle to edit1 (see GCBO)
if nargout % eventdata reserved - to be defined in
[varargout{1:nargout}] = a future version of MATLAB
gui_mainfcn(gui_State, varargin{:}); % handles structure with handles and
else user data (see GUIDATA)
gui_mainfcn(gui_State, varargin{:});
end % Hints: get(hObject,'String') returns
% End initialization code - DO NOT EDIT contents of edit1 as text
%
str2double(get(hObject,'String')) returns
% --- Executes just before ingresar_datos contents of edit1 as a double
is made visible.
function
ingresar_datos_OpeningFcn(hObject, % --- Executes during object creation,
eventdata, handles, varargin) after setting all properties.
% This function has no output args, see function edit1_CreateFcn(hObject,
OutputFcn. eventdata, handles)
% hObject handle to figure % hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in % eventdata reserved - to be defined in
a future version of MATLAB a future version of MATLAB
% handles structure with handles and % handles empty - handles not created
user data (see GUIDATA) until after all CreateFcns called
% varargin command line arguments to
ingresar_datos (see VARARGIN) % Hint: edit controls usually have a
white background on Windows.
% Choose default command line output for % See ISPC and COMPUTER.
ingresar_datos if ispc &&
handles.output = hObject; isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
% Update handles structure
guidata(hObject, handles); set(hObject,'BackgroundColor','white');
end
% UIWAIT makes ingresar_datos wait for
user response (see UIRESUME)
% uiwait(handles.figure1);
function edit2_Callback(hObject,
eventdata, handles)
% --- Outputs from this function are % hObject handle to edit2 (see GCBO)
returned to the command line. % eventdata reserved - to be defined in
function varargout = a future version of MATLAB
ingresar_datos_OutputFcn(hObject, % handles structure with handles and
eventdata, handles) user data (see GUIDATA)
% varargout cell array for returning
output args (see VARARGOUT); % Hints: get(hObject,'String') returns
% hObject handle to figure contents of edit2 as text
% eventdata reserved - to be defined in %
a future version of MATLAB str2double(get(hObject,'String')) returns
% handles structure with handles and contents of edit2 as a double
user data (see GUIDATA)

% Get default command line output from % --- Executes during object creation,
handles structure after setting all properties.
varargout{1} = handles.output; function edit2_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit2 (see GCBO)
5

% eventdata reserved - to be defined in % eventdata reserved - to be defined in


a future version of MATLAB a future version of MATLAB
% handles empty - handles not created % handles structure with handles and
until after all CreateFcns called user data (see GUIDATA)

% Hint: edit controls usually have a % Hints: get(hObject,'String') returns


white background on Windows. contents of edit4 as text
% See ISPC and COMPUTER. %
if ispc && str2double(get(hObject,'String')) returns
isequal(get(hObject,'BackgroundColor'), contents of edit4 as a double
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit4_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit4 (see GCBO)
function edit3_Callback(hObject, % eventdata reserved - to be defined in
eventdata, handles) a future version of MATLAB
% hObject handle to edit3 (see GCBO) % handles empty - handles not created
% eventdata reserved - to be defined in until after all CreateFcns called
a future version of MATLAB
% handles structure with handles and % Hint: edit controls usually have a
user data (see GUIDATA) white background on Windows.
% See ISPC and COMPUTER.
% Hints: get(hObject,'String') returns if ispc &&
contents of edit3 as text isequal(get(hObject,'BackgroundColor'),
% get(0,'defaultUicontrolBackgroundColor'))
str2double(get(hObject,'String')) returns
contents of edit3 as a double set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation,


after setting all properties.
function edit3_CreateFcn(hObject, function edit5_Callback(hObject,
eventdata, handles) eventdata, handles)
% hObject handle to edit3 (see GCBO) % hObject handle to edit5 (see GCBO)
% eventdata reserved - to be defined in % eventdata reserved - to be defined in
a future version of MATLAB a future version of MATLAB
% handles empty - handles not created % handles structure with handles and
until after all CreateFcns called user data (see GUIDATA)

% Hint: edit controls usually have a % Hints: get(hObject,'String') returns


white background on Windows. contents of edit5 as text
% See ISPC and COMPUTER. %
if ispc && str2double(get(hObject,'String')) returns
isequal(get(hObject,'BackgroundColor'), contents of edit5 as a double
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit5_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit5 (see GCBO)
function edit4_Callback(hObject, % eventdata reserved - to be defined in
eventdata, handles) a future version of MATLAB
% hObject handle to edit4 (see GCBO) % handles empty - handles not created
until after all CreateFcns called
6

% Hints: get(hObject,'String') returns


% Hint: edit controls usually have a contents of edit7 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit7 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
% --- Executes during object creation,
set(hObject,'BackgroundColor','white'); after setting all properties.
end function edit7_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit7 (see GCBO)
% eventdata reserved - to be defined in
function edit6_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit6 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit6 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit6 as a double end

% --- Executes during object creation,


after setting all properties. function edit8_Callback(hObject,
function edit6_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit8 (see GCBO)
% hObject handle to edit6 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit8 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit8 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
% --- Executes during object creation,
set(hObject,'BackgroundColor','white'); after setting all properties.
end function edit8_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit8 (see GCBO)
% eventdata reserved - to be defined in
function edit7_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit7 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
7

if ispc && %
isequal(get(hObject,'BackgroundColor'), str2double(get(hObject,'String')) returns
get(0,'defaultUicontrolBackgroundColor')) contents of edit10 as a double

set(hObject,'BackgroundColor','white');
end % --- Executes during object creation,
after setting all properties.
function edit10_CreateFcn(hObject,
eventdata, handles)
function edit9_Callback(hObject, % hObject handle to edit10 (see GCBO)
eventdata, handles) % eventdata reserved - to be defined in
% hObject handle to edit9 (see GCBO) a future version of MATLAB
% eventdata reserved - to be defined in % handles empty - handles not created
a future version of MATLAB until after all CreateFcns called
% handles structure with handles and
user data (see GUIDATA) % Hint: edit controls usually have a
white background on Windows.
% Hints: get(hObject,'String') returns % See ISPC and COMPUTER.
contents of edit9 as text if ispc &&
% isequal(get(hObject,'BackgroundColor'),
str2double(get(hObject,'String')) returns get(0,'defaultUicontrolBackgroundColor'))
contents of edit9 as a double
set(hObject,'BackgroundColor','white');
end
% --- Executes during object creation,
after setting all properties.
function edit9_CreateFcn(hObject,
eventdata, handles) function edit11_Callback(hObject,
% hObject handle to edit9 (see GCBO) eventdata, handles)
% eventdata reserved - to be defined in % hObject handle to edit11 (see GCBO)
a future version of MATLAB % eventdata reserved - to be defined in
% handles empty - handles not created a future version of MATLAB
until after all CreateFcns called % handles structure with handles and
user data (see GUIDATA)
% Hint: edit controls usually have a
white background on Windows. % Hints: get(hObject,'String') returns
% See ISPC and COMPUTER. contents of edit11 as text
if ispc && %
isequal(get(hObject,'BackgroundColor'), str2double(get(hObject,'String')) returns
get(0,'defaultUicontrolBackgroundColor')) contents of edit11 as a double

set(hObject,'BackgroundColor','white');
end % --- Executes during object creation,
after setting all properties.
function edit11_CreateFcn(hObject,
eventdata, handles)
function edit10_Callback(hObject, % hObject handle to edit11 (see GCBO)
eventdata, handles) % eventdata reserved - to be defined in
% hObject handle to edit10 (see GCBO) a future version of MATLAB
% eventdata reserved - to be defined in % handles empty - handles not created
a future version of MATLAB until after all CreateFcns called
% handles structure with handles and
user data (see GUIDATA) % Hint: edit controls usually have a
white background on Windows.
% Hints: get(hObject,'String') returns % See ISPC and COMPUTER.
contents of edit10 as text if ispc &&
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
8

% --- Executes during object creation,


set(hObject,'BackgroundColor','white'); after setting all properties.
end function edit14_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit14 (see GCBO)
% eventdata reserved - to be defined in
a future version of MATLAB
function edit13_Callback(hObject, % handles empty - handles not created
eventdata, handles) until after all CreateFcns called
% hObject handle to edit13 (see GCBO)
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
isequal(get(hObject,'BackgroundColor'),
% Hints: get(hObject,'String') returns get(0,'defaultUicontrolBackgroundColor'))
contents of edit13 as text
% set(hObject,'BackgroundColor','white');
str2double(get(hObject,'String')) returns end
contents of edit13 as a double

% --- Executes during object creation,


after setting all properties. function edit15_Callback(hObject,
function edit13_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit15 (see GCBO)
% hObject handle to edit13 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit15 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit15 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
% --- Executes during object creation,
set(hObject,'BackgroundColor','white'); after setting all properties.
end function edit15_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit15 (see GCBO)
% eventdata reserved - to be defined in
a future version of MATLAB
function edit14_Callback(hObject, % handles empty - handles not created
eventdata, handles) until after all CreateFcns called
% hObject handle to edit14 (see GCBO)
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
isequal(get(hObject,'BackgroundColor'),
% Hints: get(hObject,'String') returns get(0,'defaultUicontrolBackgroundColor'))
contents of edit14 as text
% set(hObject,'BackgroundColor','white');
str2double(get(hObject,'String')) returns end
contents of edit14 as a double
9

% eventdata reserved - to be defined in


function edit16_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit16 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit16 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit16 as a double end

% --- Executes during object creation,


after setting all properties. function edit18_Callback(hObject,
function edit16_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit18 (see GCBO)
% hObject handle to edit16 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit18 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit18 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
% --- Executes during object creation,
set(hObject,'BackgroundColor','white'); after setting all properties.
end function edit18_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit18 (see GCBO)
% eventdata reserved - to be defined in
function edit17_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit17 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit17 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit17 as a double end

% --- Executes during object creation,


after setting all properties. function edit19_Callback(hObject,
function edit17_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit19 (see GCBO)
% hObject handle to edit17 (see GCBO)
10

% eventdata reserved - to be defined in


a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit19 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit19 as a double end

% --- Executes during object creation,


after setting all properties. function edit21_Callback(hObject,
function edit19_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit21 (see GCBO)
% hObject handle to edit19 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit21 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit21 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit21_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit21 (see GCBO)
% eventdata reserved - to be defined in
function edit12_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit12 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit12 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit12 as a double end

% --- Executes during object creation,


after setting all properties. function edit22_Callback(hObject,
function edit12_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit22 (see GCBO)
% hObject handle to edit12 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
11

% Hints: get(hObject,'String') returns if ispc &&


contents of edit22 as text isequal(get(hObject,'BackgroundColor'),
% get(0,'defaultUicontrolBackgroundColor'))
str2double(get(hObject,'String')) returns
contents of edit22 as a double set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation,


after setting all properties.
function edit22_CreateFcn(hObject, function edit27_Callback(hObject,
eventdata, handles) eventdata, handles)
% hObject handle to edit22 (see GCBO) % hObject handle to edit27 (see GCBO)
% eventdata reserved - to be defined in % eventdata reserved - to be defined in
a future version of MATLAB a future version of MATLAB
% handles empty - handles not created % handles structure with handles and
until after all CreateFcns called user data (see GUIDATA)

% Hint: edit controls usually have a % Hints: get(hObject,'String') returns


white background on Windows. contents of edit27 as text
% See ISPC and COMPUTER. %
if ispc && str2double(get(hObject,'String')) returns
isequal(get(hObject,'BackgroundColor'), contents of edit27 as a double
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white');
end % --- Executes during object creation,
after setting all properties.
function edit27_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit27 (see GCBO)
function edit25_Callback(hObject, % eventdata reserved - to be defined in
eventdata, handles) a future version of MATLAB
% hObject handle to edit25 (see GCBO) % handles empty - handles not created
% eventdata reserved - to be defined in until after all CreateFcns called
a future version of MATLAB
% handles structure with handles and % Hint: edit controls usually have a
user data (see GUIDATA) white background on Windows.
% See ISPC and COMPUTER.
% Hints: get(hObject,'String') returns if ispc &&
contents of edit25 as text isequal(get(hObject,'BackgroundColor'),
% get(0,'defaultUicontrolBackgroundColor'))
str2double(get(hObject,'String')) returns
contents of edit25 as a double set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation,


after setting all properties.
function edit25_CreateFcn(hObject, function edit28_Callback(hObject,
eventdata, handles) eventdata, handles)
% hObject handle to edit25 (see GCBO) % hObject handle to edit28 (see GCBO)
% eventdata reserved - to be defined in % eventdata reserved - to be defined in
a future version of MATLAB a future version of MATLAB
% handles empty - handles not created % handles structure with handles and
until after all CreateFcns called user data (see GUIDATA)

% Hint: edit controls usually have a % Hints: get(hObject,'String') returns


white background on Windows. contents of edit28 as text
% See ISPC and COMPUTER.
12

%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit28 as a double end

% --- Executes during object creation,


after setting all properties. function edit30_Callback(hObject,
function edit28_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit30 (see GCBO)
% hObject handle to edit28 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit30 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit30 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit30_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit30 (see GCBO)
% eventdata reserved - to be defined in
function edit29_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit29 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit29 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit29 as a double end

% --- Executes during object creation,


after setting all properties. function edit31_Callback(hObject,
function edit29_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit31 (see GCBO)
% hObject handle to edit29 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit31 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit31 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
13

% --- Executes during object creation,


after setting all properties. function edit33_Callback(hObject,
function edit31_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit33 (see GCBO)
% hObject handle to edit31 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit33 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit33 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit33_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit33 (see GCBO)
% eventdata reserved - to be defined in
function edit32_Callback(hObject, a future version of MATLAB
eventdata, handles) % handles empty - handles not created
% hObject handle to edit32 (see GCBO) until after all CreateFcns called
% eventdata reserved - to be defined in
a future version of MATLAB % Hint: edit controls usually have a
% handles structure with handles and white background on Windows.
user data (see GUIDATA) % See ISPC and COMPUTER.
if ispc &&
% Hints: get(hObject,'String') returns isequal(get(hObject,'BackgroundColor'),
contents of edit32 as text get(0,'defaultUicontrolBackgroundColor'))
%
str2double(get(hObject,'String')) returns set(hObject,'BackgroundColor','white');
contents of edit32 as a double end

% --- Executes during object creation,


after setting all properties. function edit34_Callback(hObject,
function edit32_CreateFcn(hObject, eventdata, handles)
eventdata, handles) % hObject handle to edit34 (see GCBO)
% hObject handle to edit32 (see GCBO) % eventdata reserved - to be defined in
% eventdata reserved - to be defined in a future version of MATLAB
a future version of MATLAB % handles structure with handles and
% handles empty - handles not created user data (see GUIDATA)
until after all CreateFcns called
% Hints: get(hObject,'String') returns
% Hint: edit controls usually have a contents of edit34 as text
white background on Windows. %
% See ISPC and COMPUTER. str2double(get(hObject,'String')) returns
if ispc && contents of edit34 as a double
isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit34_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit34 (see GCBO)
14

% eventdata reserved - to be defined in % eventdata reserved - to be defined in


a future version of MATLAB a future version of MATLAB
% handles empty - handles not created % handles structure with handles and
until after all CreateFcns called user data (see GUIDATA)

% Hint: edit controls usually have a % Hints: get(hObject,'String') returns


white background on Windows. contents of edit39 as text
% See ISPC and COMPUTER. %
if ispc && str2double(get(hObject,'String')) returns
isequal(get(hObject,'BackgroundColor'), contents of edit39 as a double
get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); % --- Executes during object creation,


end after setting all properties.
function edit39_CreateFcn(hObject,
eventdata, handles)
% hObject handle to edit39 (see GCBO)
function edit38_Callback(hObject, % eventdata reserved - to be defined in
eventdata, handles) a future version of MATLAB
% hObject handle to edit38 (see GCBO) % handles empty - handles not created
% eventdata reserved - to be defined in until after all CreateFcns called
a future version of MATLAB
% handles structure with handles and % Hint: edit controls usually have a
user data (see GUIDATA) white background on Windows.
% See ISPC and COMPUTER.
% Hints: get(hObject,'String') returns if ispc &&
contents of edit38 as text isequal(get(hObject,'BackgroundColor'),
% get(0,'defaultUicontrolBackgroundColor'))
str2double(get(hObject,'String')) returns
contents of edit38 as a double set(hObject,'BackgroundColor','white');
end

% --- Executes during object creation,


after setting all properties. % --- Executes on button press in
function edit38_CreateFcn(hObject, togglebutton3.
eventdata, handles) function togglebutton3_Callback(hObject,
% hObject handle to edit38 (see GCBO) eventdata, handles)
% eventdata reserved - to be defined in % hObject handle to togglebutton3 (see
a future version of MATLAB GCBO)
% handles empty - handles not created % eventdata reserved - to be defined in
until after all CreateFcns called a future version of MATLAB
% handles structure with handles and
% Hint: edit controls usually have a user data (see GUIDATA)
white background on Windows. global H1 H2 D1 D2 D3 D4 Q1 Q2 PE1 PE2 nG
% See ISPC and COMPUTER. nT nB nM;
if ispc && H1=str2double(get(handles.edit11,'String'
isequal(get(hObject,'BackgroundColor'), ));
get(0,'defaultUicontrolBackgroundColor')) H2=str2double(get(handles.edit30,'String'
));
set(hObject,'BackgroundColor','white'); D1=str2double(get(handles.edit12,'String'
end ));
D2=str2double(get(handles.edit13,'String'
));
D3=str2double(get(handles.edit14,'String'
));
function edit39_Callback(hObject, D4=str2double(get(handles.edit38,'String'
eventdata, handles) ));
% hObject handle to edit39 (see GCBO) Q1=str2double(get(handles.edit15,'String'
));
15

Q2=str2double(get(handles.edit31,'String' % Hint: edit controls usually have a


)); white background on Windows.
PE1=str2double(get(handles.edit16,'String % See ISPC and COMPUTER.
')); if ispc &&
PE2=str2double(get(handles.edit32,'String isequal(get(hObject,'BackgroundColor'),
')); get(0,'defaultUicontrolBackgroundColor'))
nG=str2double(get(handles.edit17,'String'
)); set(hObject,'BackgroundColor','white');
nT=str2double(get(handles.edit18,'String' end
));
nB=str2double(get(handles.edit34,'String'
));
nM=str2double(get(handles.edit33,'String'
));
if H1<=0 || H2<=0 || D1<=0 || D2<=0 ||
D3<=0 || D4<=0 || Q1<=0 || Q2<=0 ...
|| PE1 <=0 || PE2<=0 || nG>1 ||
nT>1 || nB>1 || nM>1 || nG<=0 ...
|| nT<=0 || nB<=0 || nM<=0
errordlg('Los datos ingresados son
incorrectos','¡ERROR!');
else
close(ingresar_datos);
resultados;
end

% Hint: get(hObject,'Value') returns


toggle state of togglebutton3

Imagen 2.
function edit40_Callback(hObject, RESULTADOS OBTENIDOS: En esta parte del programa
eventdata, handles) se mostrará los resultados obtenidos teniendo encuentra los
% hObject handle to edit40 (see GCBO) datos de entrada.
% eventdata reserved - to be defined in A continuación se mostrara 3 ejecuciones del programa
a future version of MATLAB realizado con diferentes datos :
% handles structure with handles and
user data (see GUIDATA) EJECUCIÓN #1

% Hints: get(hObject,'String') returns


contents of edit40 as text
%
str2double(get(hObject,'String')) returns
contents of edit40 as a double

% --- Executes during object creation,


after setting all properties.
function edit40_CreateFcn(hObject, Imagen 3.
eventdata, handles)
% hObject handle to edit40 (see GCBO)
% eventdata reserved - to be defined in
a future version of MATLAB
% handles empty - handles not created
until after all CreateFcns called
16

Imagen 4. Imagen 8.
EJECUCIÓN # 2

Imagen 5.

Imagen 6.

EJECUCIÓN #3

Imagen 7.

Você também pode gostar