function varargout = fig_dest_cont(varargin)
% FIG_DEST_CONT M-file for fig_dest_cont.fig
% FIG_DEST_CONT, by itself, creates a new FIG_DEST_CONT or raises the existing
% singleton*.
%
% H = FIG_DEST_CONT returns the handle to a new FIG_DEST_CONT or the handle to
% the existing singleton*.
%
% FIG_DEST_CONT('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in FIG_DEST_CONT.M with the given input arguments.
%
% FIG_DEST_CONT('Property','Value',...) creates a new FIG_DEST_CONT or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before fig_dest_cont_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to fig_dest_cont_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools 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 fig_dest_cont
% Last Modified by GUIDE v2.5 07-Apr-2013 15:11:18
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fig_dest_cont_OpeningFcn, ...
'gui_OutputFcn', @fig_dest_cont_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before fig_dest_cont is made visible.
function fig_dest_cont_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to fig_dest_cont (see VARARGIN)
% Choose default command line output for fig_dest_cont
axes(handles.axes5)
a=imread('Dibujo.jpg');
image(a);
axis off
valor=str2num(get(handles.xf,'string'));
set(handles.slider1,'value',valor);
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes fig_dest_cont wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = fig_dest_cont_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function Np_Callback(hObject, eventdata, handles)
% hObject handle to Np (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Np as text
% str2double(get(hObject,'String')) returns contents of Np as a double
% --- Executes during object creation, after setting all properties.
function Np_CreateFcn(hObject, eventdata, handles)
% hObject handle to Np (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function F_Callback(hObject, eventdata, handles)
% hObject handle to F (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of F as text
% str2double(get(hObject,'String')) returns contents of F as a double
% --- Executes during object creation, after setting all properties.
function F_CreateFcn(hObject, eventdata, handles)
% hObject handle to F (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function q_Callback(hObject, eventdata, handles)
% hObject handle to q (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of q as text
% str2double(get(hObject,'String')) returns contents of q as a double
% --- Executes during object creation, after setting all properties.
function q_CreateFcn(hObject, eventdata, handles)
% hObject handle to q (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function xf_Callback(hObject, eventdata, handles)
% hObject handle to xf (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of xf as text
% str2double(get(hObject,'String')) returns contents of xf as a double
valor=str2num(get(handles.xf,'string'));
set(handles.slider1,'value',valor);
% --- Executes during object creation, after setting all properties.
function xf_CreateFcn(hObject, eventdata, handles)
% hObject handle to xf (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function R_Callback(hObject, eventdata, handles)
% hObject handle to R (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of R as text
% str2double(get(hObject,'String')) returns contents of R as a double
% --- Executes during object creation, after setting all properties.
function R_CreateFcn(hObject, eventdata, handles)
% hObject handle to R (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function Fplate_Callback(hObject, eventdata, handles)
% hObject handle to Fplate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of Fplate as text
% str2double(get(hObject,'String')) returns contents of Fplate as a double
% --- Executes during object creation, after setting all properties.
function Fplate_CreateFcn(hObject, eventdata, handles)
% hObject handle to Fplate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in EJECUTAR.
function EJECUTAR_Callback(hObject, eventdata, handles)
% hObject handle to EJECUTAR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Fplate=str2num(get(handles.Fplate,'string'));
Np=str2num(get(handles.Np,'string'));
F=str2num(get(handles.F,'string'));
q=str2num(get(handles.q,'string'));
xf=str2num(get(handles.xf,'string'));
R=str2num(get(handles.R,'string'));
if Fplate>=Np
errordlg('El nmero de platos debe ser mayor que el plato de alimentacion')
error('El nmero de platos debe ser mayor que el plato de alimentacion')
end
if xf==0 || xf>1
errordlg('La composicion de la alimentacion tiene que estar entre 1 y 0')
error('La composicion de la alimentacion tiene que estar entre 1 y 0')
end
[t,x,y]=dest_cont(Fplate,Np,F,q,xf,R);
axes(handles.axes1);
platos=1:Np;
mesh(platos,t,x)
xlabel('N Plato')
ylabel('Tiempo (h)')
zlabel('x')
title('Evolucin de la composicin en la fase lquida')
axis([1 Np 0 t(end) 0 1])
rotate3d on
axes(handles.axes2);
platos=1:Np;
mesh(platos,t,y)
xlabel('N Plato')
ylabel('Tiempo (h)')
zlabel('y')
title('Evolucin de la composicin en la fase vapor')
axis([1 Np 0 t(end) 0 1])
rotate3d on
axes(handles.axes3);
plot(t,x(1:end,1),'r')
xlabel('Tiempo (h)')
ylabel('xd')
title('Composicin en el destilado')
axis([0 t(end) 0 1])
axes(handles.axes4);
plot(t,x(1:end,Np),'r')
xlabel('Tiempo (h)')
ylabel('xw')
title('Composicin en cola')
axis([0 t(end) 0 max(x(1:end,Np)+2e-3)])
% --- Executes on button press in CERRAR.
function CERRAR_Callback(hObject, eventdata, handles)
% hObject handle to CERRAR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
delete (gcf)
% --- Executes on slider movement.
function slider1_Callback(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
valor=get(handles.slider1,'value');
set(handles.xf,'string',valor);
% --- Executes during object creation, after setting all properties.
function slider1_CreateFcn(hObject, eventdata, handles)
% hObject handle to slider1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end